void wc_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e) { if (e.Error == null) { JsonArray items = JsonValue.Parse(e.Result) as JsonArray; ObjectList list = new ObjectList(); list.EntityType = "T_INSPECTION_LINE"; foreach(JsonObject row in items) { GeneralObject go = new GeneralObject(); go.EntityType = "T_INSPECTION_LINE"; go.SetPropertyValue("precaution", row["precaution"], true); go.SetPropertyValue("road", row["road"], true); go.SetPropertyValue("unit_name", row["unit_name"], true); go.SetPropertyValue("cus_dom", row["cus_dom"], true); go.SetPropertyValue("cus_dy", row["cus_dy"], true); go.SetPropertyValue("cus_floor", row["cus_floor"], true); go.SetPropertyValue("cus_room", row["cus_room"], true); go.SetPropertyValue("user_name", row["user_name"], true); go.SetPropertyValue("telphone", row["telphone"], true); go.SetPropertyValue("departure_time", row["departure_time"], true); go.SetPropertyValue("precaution_notified", row["precaution_notified"], true); go.SetPropertyValue("sn", row["sn"], true); list.Add(go); } paperGrid.ItemsSource = list; } }
private void toleft_Click(object sender, RoutedEventArgs e) { if (userfiles.SelectedItem == null) { return; } Com.Aote.ObjectTools.ObjectList c = userfiles.ItemsSource as Com.Aote.ObjectTools.ObjectList; IList list = new Com.Aote.ObjectTools.ObjectList(); foreach (Object obj in userfiles.SelectedItems) { list.Add(obj); } Com.Aote.ObjectTools.ObjectList target = GetTarget(); //if (target.selectObject == null) target.SelectObject = list; //else //(target.selectObject as IList).Add(userfiles.SelectedItem); foreach (Object obj in list) { c.Remove(obj); } c.OnPropertyChanged("Count"); }
//pos 上传 public void posUpload() { ObjectList datalist = new ObjectList(); GetEvent("pcPort").pcPort = PcPort; if (GetEvent("OpenComm").OpenComm() != 0) { MessageBox.Show("打开串口" + PcPort + "失败!"); return; } GetEvent("ack").ack = "C"; GetEvent("RespAckPos").RespAckPos(); var ret = 0; while ((ret = GetEvent("Readdata").Readdata()) == 0) { var data = GetEvent("strdata").strdata; //如果数据内容是ok,传完了,发送ok过去后pos机控件开始清除数据 if (data == "OK") { datalist.Completed += (o, a) => { if (a.Error == null) { GetEvent("ack").ack = "C"; GetEvent("RespAckPos").RespAckPos(); } }; datalist.Save(); break; } else { MessageBox.Show(data); //解析,保存数据 GeneralObject go = parsePos(data); datalist.Add(go); //校验数据 ,正确 ,数据存储,否则,发送N GetEvent("ack").ack = "C"; GetEvent("RespAckPos").RespAckPos(); } } if (ret != 0) { MessageBox.Show("错误类型" + ret); } //关串口 GetEvent("CloseComm").CloseComm(); }
private void toleft_Click(object sender, RoutedEventArgs e) { if (userfiles.SelectedItem == null) return; Com.Aote.ObjectTools.ObjectList c = userfiles.ItemsSource as Com.Aote.ObjectTools.ObjectList; IList list = new Com.Aote.ObjectTools.ObjectList(); foreach (Object obj in userfiles.SelectedItems) list.Add(obj); Com.Aote.ObjectTools.ObjectList target = GetTarget(); //if (target.selectObject == null) target.SelectObject = list; //else //(target.selectObject as IList).Add(userfiles.SelectedItem); foreach (Object obj in list) c.Remove(obj); c.OnPropertyChanged("Count"); }
// private string address = "#f_region##f_districtname##f_startbuild##f_startunit##f_startlayer#"; //生成用气地址列表 public void Invoke() { State = State.StartLoad; this.isBusy = true; //楼号 string startbuild = this.GetPropertyValue("f_startbuild") + ""; string endbuild = startbuild; //结束楼号不为空 if (this.GetPropertyValue("f_endbuild") + "" != "") { endbuild = this.GetPropertyValue("f_endbuild") + ""; } //单元 string startunit = this.GetPropertyValue("f_startunit") + ""; string endunit = startunit; if (this.GetPropertyValue("f_endunit") + "" != "") { endunit = this.GetPropertyValue("f_endunit") + ""; } //楼层 string startlayer = this.GetPropertyValue("f_startlayer") + ""; string endlayer = startlayer; if (this.GetPropertyValue("f_endlayer") + "" != "") { endlayer = this.GetPropertyValue("f_endlayer") + ""; } //房间号 string startroom = this.GetPropertyValue("f_startroom") + ""; string endroom = startroom; if (this.GetPropertyValue("f_endroom") + "" != "") { endroom = this.GetPropertyValue("f_endroom") + ""; } //楼号列表 List <string> builds = GetList(startbuild, endbuild); List <string> units = GetList(startunit, endunit); List <string> layers = GetList(startlayer, endlayer); List <string> rooms = GetList(startroom, endroom); ObjectList plans = new ObjectList(); plans.WebClientInfo = this.WebClientInfo; plans.Name = Guid.NewGuid().ToString(); try { foreach (string build in builds) { foreach (string unit in units) { foreach (string layer in layers) { //每层多少室 foreach (string room in rooms) { GeneralObject go = new GeneralObject(); go.EntityType = this.EntityType; go.WebClientInfo = this.WebClientInfo; go.SetPropertyValue("f_road", this.GetPropertyValue("f_road") + "", true); go.SetPropertyValue("f_districtname", this.GetPropertyValue("f_districtname") + "", true); //设置楼号,有模式,按模式设置 string buildpattern = this.GetPropertyValue("f_buildpattern") + ""; string str = MatchPattern(build, buildpattern); go.SetPropertyValue("f_cusDom", str, true); //设置单元 string unitpattern = this.GetPropertyValue("f_unitpattern") + ""; str = MatchPattern(unit, unitpattern); go.SetPropertyValue("f_cusDy", str, true); //设置层 string layerpattern = this.GetPropertyValue("f_layerpattern") + ""; str = MatchPattern(layer, layerpattern); go.SetPropertyValue("f_cusFloor", str, true); //设置每层室 string roompattern = this.GetPropertyValue("f_roompattern") + ""; str = MatchPattern(room, roompattern); go.SetPropertyValue("f_apartment", str, true); //Change(); //string ad = this.GetPropertyValue("f_gasaddress") + ""; go.Name = "test"; plans.Add(go); } } } } }catch (NullReferenceException e) { MessageBox.Show("输入的内容不符合要求"); } finally { plans.Completed += plans_Completed; plans.Save(); } }
//通过树状结构子属性名把列表转换成通用对象列表 public static BaseObjectList ToList(object list, string childPropertyName) { //只有枚举对象才可以转换成通用对象 if (!(list is IEnumerable)) { throw new Exception("非枚举对象无法转换成对象列表:"); } BaseObjectList result = new ObjectList(); foreach (GeneralObject go in (IEnumerable)list) { BaseObjectList bol = (BaseObjectList)go.GetPropertyValue(childPropertyName); if (bol != null) { foreach (GeneralObject cgo in bol) { result.Add(cgo); } } } return result; }
//把列表转换成通用对象列表 public static BaseObjectList ToObjectList(object list) { if (list == null) { throw new NullReferenceException(); } //只有枚举对象才可以转换成通用对象 if (!(list is IEnumerable)) { throw new Exception("非枚举对象无法转换成对象列表"); } BaseObjectList result = new ObjectList(); foreach (GeneralObject go in (IEnumerable)list) { result.Add(go); } return result; }
private void saveButton_Click(object sender, RoutedEventArgs e) { ui_handBusy.IsBusy = true; BaseObjectList list = daninfos.ItemsSource as BaseObjectList; ObjectList data = new ObjectList(); //参数对象 GeneralObject param = FrameworkElementExtension.FindResource(this.saveButton, "param") as GeneralObject; //对于每一条记录 foreach (GeneralObject go in list) { //表状态 var meterstate = meter.SelectedValue; // 抄表记录里的上期指数 var lastinputnum = go.GetPropertyValue("lastinputgasnum"); // 本次抄表指数 var lastrecord = go.GetPropertyValue("lastrecord"); // 本次指数为空,这条不上传 if (lastrecord == null) { continue; } // 本期指数小于上期指数,不上传 if (double.Parse(lastrecord.ToString()) < double.Parse(lastinputnum.ToString())) { continue; } go.CopyDataFrom(param); data.Add(go); } if (data.Count == 0) return; //将产生的json串送后台服务进行处理 WebClientInfo wci = Application.Current.Resources["server"] as WebClientInfo; string uri = wci.BaseAddress + "/handcharge/record/payfeeforhand?uuid=" + System.Guid.NewGuid().ToString(); WebClient client = new WebClient(); client.UploadStringCompleted += client_UploadStringCompleted; client.UploadStringAsync(new Uri(uri), data.ToJson().ToString()); }
//生成用气地址列表 public void Invoke() { State = State.StartLoad; this.isBusy = true; //楼号 string startbuild = this.GetPropertyValue("f_startbuild") + ""; string endbuild = startbuild; //结束楼号不为空 if (this.GetPropertyValue("f_endbuild") + "" != "") { endbuild = this.GetPropertyValue("f_endbuild") + ""; } //单元 string startunit = this.GetPropertyValue("f_startunit") + ""; string endunit = startunit; if (this.GetPropertyValue("f_endunit") + "" != "") { endunit = this.GetPropertyValue("f_endunit") + ""; } //楼层 string startlayer = this.GetPropertyValue("f_startlayer") + ""; string endlayer = startlayer; if (this.GetPropertyValue("f_endlayer") + "" != "") { endlayer = this.GetPropertyValue("f_endlayer") + ""; } //房间号 string startroom = this.GetPropertyValue("f_startroom") + ""; string endroom = startroom; if (this.GetPropertyValue("f_endroom") + "" != "") { endroom = this.GetPropertyValue("f_endroom") + ""; } //楼号列表 List<string> builds = GetList(startbuild, endbuild); List<string> units = GetList(startunit, endunit); List<string> layers = GetList(startlayer, endlayer); List<string> rooms = GetList(startroom, endroom); ObjectList plans = new ObjectList(); plans.WebClientInfo = this.WebClientInfo; plans.Name = Guid.NewGuid().ToString(); foreach (string build in builds) { foreach (string unit in units) { foreach (string layer in layers) { //每层多少室 foreach (string room in rooms) { //设置楼号 //SetPropertyValue("f_startbuild", build, true); //设置单元 //SetPropertyValue("f_startunit", unit, true); //设置层 //SetPropertyValue("f_startlayer", layer, true); //设置每层室 //SetPropertyValue("f_room", room, true); GeneralObject go = new GeneralObject(); go.EntityType = this.EntityType; go.WebClientInfo = this.WebClientInfo; go.SetPropertyValue("f_road", this.GetPropertyValue("f_road") + "", true); go.SetPropertyValue("f_districtname", this.GetPropertyValue("f_districtname") + "", true); //设置楼号,有模式,按模式设置 string buildpattern = this.GetPropertyValue("f_buildpattern") + ""; string str = MatchPattern(build, buildpattern); go.SetPropertyValue("f_cusDom", str, true); //设置单元 string unitpattern = this.GetPropertyValue("f_unitpattern") + ""; str = MatchPattern(unit, unitpattern); go.SetPropertyValue("f_cusDy", str, true); //设置层 string layerpattern = this.GetPropertyValue("f_layerpattern") + ""; str = MatchPattern(layer, layerpattern); go.SetPropertyValue("f_cusFloor", str, true); //设置每层室 string roompattern = this.GetPropertyValue("f_roompattern") + ""; str = MatchPattern(room, roompattern); go.SetPropertyValue("f_apartment", str, true); //Change(); //string ad = this.GetPropertyValue("f_gasaddress") + ""; go.Name = "test"; plans.Add(go); } } } } plans.Completed += plans_Completed; plans.Save(); }
// private string address = "#f_region##f_districtname##f_startbuild##f_startunit##f_startlayer#"; //生成用气地址列表 public void Invoke() { State = State.StartLoad; this.isBusy = true; //楼号 string startbuild = this.GetPropertyValue("f_startbuild") + ""; string endbuild = startbuild; //结束楼号不为空 if (this.GetPropertyValue("f_endbuild") + "" != "") { endbuild = this.GetPropertyValue("f_endbuild") + ""; } //单元 string startunit = this.GetPropertyValue("f_startunit") + ""; string endunit = startunit; if (this.GetPropertyValue("f_endunit") + "" != "") { endunit = this.GetPropertyValue("f_endunit") + ""; } //楼层 string startlayer = this.GetPropertyValue("f_startlayer") + ""; string endlayer = startlayer; if (this.GetPropertyValue("f_endlayer") + "" != "") { endlayer = this.GetPropertyValue("f_endlayer") + ""; } //房间号 string startroom = this.GetPropertyValue("f_startroom") + ""; string endroom = startroom; if (this.GetPropertyValue("f_endroom") + "" != "") { endroom = this.GetPropertyValue("f_endroom") + ""; } //楼号列表 List <string> builds = GetList(startbuild, endbuild); List <string> units = GetList(startunit, endunit); List <string> layers = GetList(startlayer, endlayer); List <string> rooms = GetList(startroom, endroom); ObjectList plans = new ObjectList(); plans.WebClientInfo = this.WebClientInfo; plans.Name = Guid.NewGuid().ToString(); try { for (int a = 0; a < builds.Count; a++) { for (int b = 0; b < units.Count; b++) { for (int c = 0; c < layers.Count; c++) { for (int d = 0; d < rooms.Count; d++) { GeneralObject go = new GeneralObject(); go.EntityType = this.EntityType; go.WebClientInfo = this.WebClientInfo; go.SetPropertyValue("f_road", this.GetPropertyValue("f_road") + "", true); go.SetPropertyValue("f_districtname", this.GetPropertyValue("f_districtname") + "", true); //设置楼号,有模式,按模式设置 string buildpattern = this.GetPropertyValue("f_buildpattern") + ""; string str = MatchPattern(builds[a], buildpattern); go.SetPropertyValue("f_cusDom", str, true); //设置单元 string unitpattern = this.GetPropertyValue("f_unitpattern") + ""; str = MatchPattern(units[b], unitpattern); go.SetPropertyValue("f_cusDy", str, true); //设置层 string layerpattern = this.GetPropertyValue("f_layerpattern") + ""; str = MatchPattern(layers[c], layerpattern); go.SetPropertyValue("f_cusFloor", str, true); //设置每层室 string roompattern = this.GetPropertyValue("f_roompattern") + ""; int roomInt, endroomInt; int.TryParse(rooms[d], out roomInt); int.TryParse(endroom, out endroomInt); str = MatchPattern((roomInt + endroomInt * b).ToString(), roompattern); go.SetPropertyValue("f_apartment", str, true); go.Name = "test"; plans.Add(go); } } } } } catch (NullReferenceException) { MessageBox.Show("输入有误"); } finally { plans.Completed += plans_Completed; plans.Save(); } }
public override void Invoke() { No = -1; State = State.Start; IsBusy = true; DataList = new ObjectList(); double no; while ((no = GetNo()) != 0) { GeneralObject go = CreateObj(Source, no); DataList.Add(go); } Source.Completed += (o, e) => { Source.NewPropertyValue("id"); }; Source.SetPropertyValue("invoicelist", DataList, true); Source.Save(); IsBusy = false; State = State.End; MessageBox.Show("分配完成!"); }
private bool FillPrecautionsAccordingToChoices2(Panel p, GeneralObject go, ObjectList lines, bool mustSelect, bool checkContradition, string equipment) { bool selected = false; bool normalChecked = false; bool abnormalChecked = false; foreach (UIElement element in p.Children) { if (element is CheckBox) { CheckBox aBox = element as CheckBox; if (aBox.IsChecked.HasValue && aBox.IsChecked.Value) { if (aBox.Content.Equals("无") || aBox.Content.Equals("正常")) normalChecked = true; else abnormalChecked = true; } if (aBox.IsChecked.HasValue) selected |= aBox.IsChecked.Value; } } if (!selected && mustSelect) { MessageBox.Show("请选择" + equipment + "隐患选项!"); return false; } if (normalChecked && abnormalChecked && checkContradition) { MessageBox.Show("请检查" + equipment + "隐患选项!"); return false; } foreach (UIElement element in p.Children) { if (element is CheckBox) { CheckBox aBox = element as CheckBox; if (aBox.IsChecked.HasValue && aBox.IsChecked.Value) { if (aBox.Content.Equals("无") || aBox.Content.Equals("正常")) continue; GeneralObject line = CreateALine(go); lines.Add(line); line.SetPropertyValue("EQUIPMENT", equipment, true); if (aBox.Content.Equals("腐蚀")) { if(rbErodedSlight.IsChecked.Value) line.SetPropertyValue("CONTENT", rbErodedSlight.Content, true); else if (rbErodedSevere.IsChecked.Value) line.SetPropertyValue("CONTENT", rbErodedSevere.Content, true); else if (rbErodedModerate.IsChecked.Value) line.SetPropertyValue("CONTENT", rbErodedModerate.Content, true); } } } } return true; }
// private string address = "#f_region##f_districtname##f_startbuild##f_startunit##f_startlayer#"; //生成用气地址列表 public void Invoke() { State = State.StartLoad; this.isBusy = true; //楼号 string startbuild = this.GetPropertyValue("f_startbuild") + ""; string endbuild = startbuild; //结束楼号不为空 if (this.GetPropertyValue("f_endbuild") + "" != "") { endbuild = this.GetPropertyValue("f_endbuild") + ""; } //单元 string startunit = this.GetPropertyValue("f_startunit") + ""; string endunit = startunit; if (this.GetPropertyValue("f_endunit") + "" != "") { endunit = this.GetPropertyValue("f_endunit") + ""; } //楼层 string startlayer = this.GetPropertyValue("f_startlayer") + ""; string endlayer = startlayer; if (this.GetPropertyValue("f_endlayer") + "" != "") { endlayer = this.GetPropertyValue("f_endlayer") + ""; } //房间号 string startroom = this.GetPropertyValue("f_startroom") + ""; string endroom = startroom; if (this.GetPropertyValue("f_endroom") + "" != "") { endroom = this.GetPropertyValue("f_endroom") + ""; } //楼号列表 List<string> builds = GetList(startbuild, endbuild); List<string> units = GetList(startunit, endunit); List<string> layers = GetList(startlayer, endlayer); List<string> rooms = GetList(startroom, endroom); ObjectList plans = new ObjectList(); plans.WebClientInfo = this.WebClientInfo; plans.Name = Guid.NewGuid().ToString(); try { for (int a = 0; a < builds.Count; a++) { for (int b = 0; b < units.Count; b++) { for (int c = 0; c < layers.Count; c++) { for (int d = 0; d < rooms.Count; d++) { GeneralObject go = new GeneralObject(); go.EntityType = this.EntityType; go.WebClientInfo = this.WebClientInfo; go.SetPropertyValue("f_road", this.GetPropertyValue("f_road") + "", true); go.SetPropertyValue("f_districtname", this.GetPropertyValue("f_districtname") + "", true); //设置楼号,有模式,按模式设置 string buildpattern = this.GetPropertyValue("f_buildpattern") + ""; string str = MatchPattern(builds[a], buildpattern); go.SetPropertyValue("f_cusDom", str, true); //设置单元 string unitpattern = this.GetPropertyValue("f_unitpattern") + ""; str = MatchPattern(units[b], unitpattern); go.SetPropertyValue("f_cusDy", str, true); //设置层 string layerpattern = this.GetPropertyValue("f_layerpattern") + ""; str = MatchPattern(layers[c], layerpattern); go.SetPropertyValue("f_cusFloor", str, true); //设置每层室 string roompattern = this.GetPropertyValue("f_roompattern") + ""; int roomInt,endroomInt; int.TryParse(rooms[d], out roomInt); int.TryParse(endroom, out endroomInt); str = MatchPattern((roomInt + endroomInt * c).ToString(), roompattern); go.SetPropertyValue("f_apartment", str, true); go.Name = "test"; plans.Add(go); } } } } }catch(NullReferenceException) { MessageBox.Show("error"); } finally { plans.Completed += plans_Completed; plans.Save(); } }
void userfiles_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { kbsellgasbusy.IsBusy = false; busy.IsBusy = false; if (e.Error != null) { MessageBox.Show("查询失败,链接错误!"); return; } //把数据转换成JSON JsonObject item = JsonValue.Parse(e.Result) as JsonObject; if (item.ContainsKey("error")) { string error = item["error"]; MessageBox.Show("查询失败:" + error); busy.IsBusy = false; return; } //把用户数据写到交费界面上 ui_username.Text = (string)item["f_username"]; ui_usertype.Text = (string)item["f_usertype"]; ui_districtname.Text = (string)item["f_districtname"]; ui_gasproperties.Text = (string)item["f_gasproperties"]; ui_stairpricetype.Text = (string)item["f_stairtype"]; zhye.Text = item["f_zhye"].ToString(); ui_address.Text = (string)item["f_address"]; //ui_gaspricetype.Text = (String)item["f_gaspricetype"]; ui_userid.Text = (string)item["infoid"]; zhe.Text=item["f_zherownum"].ToString(); //ui_dibaohu.IsChecked = item["f_dibaohu"].ToString().Equals("1"); ui_userstate.Text = (string)item["f_userstate"]; ui_paytype.Text = (string)item["f_payment"]; // ui_gasprice.Text = item["f_gasprice"].ToString(); //把欠费数据插入到欠费表中 ObjectList list = new ObjectList(); // 当前正在处理的表号 String currentId = ""; // 总的上期指数 decimal lastnum = 0; // 总气量 decimal gasSum = 0; // 总气费 decimal feeSum = 0; //总的滞纳金 decimal zhinajinAll = 0; //余额 decimal f_zhye = decimal.Parse(item["f_zhye"].ToString()); JsonArray bills = item["f_hands"] as JsonArray; foreach (JsonObject json in bills) { GeneralObject go = new GeneralObject(); go.EntityType = "t_handplan"; //默认选中 go.IsChecked = true; //上期指数 decimal lastinputgasnum = (decimal)json["lastinputgasnum"]; go.SetPropertyValue("lastinputgasnum", lastinputgasnum, false); string f_userid = (string)json["f_userid"]; go.SetPropertyValue("f_userid", f_userid, false); // 如果表号变了 if (!f_userid.Equals(currentId)) { currentId = f_userid; lastnum += lastinputgasnum; } //计算总金额 decimal oughtfee = (decimal)json["oughtfee"]; go.SetPropertyValue("oughtfee", oughtfee, false); feeSum += oughtfee; // 计算总气量 decimal oughtamount = (decimal)json["oughtamount"]; gasSum += oughtamount; go.SetPropertyValue("oughtamount", oughtamount, false); int id = (int)json["id"]; go.SetPropertyValue("id", id, false); //计算总滞纳金 decimal f_zhinajin = (decimal)json["f_zhinajin"]; zhinajinAll += f_zhinajin; go.SetPropertyValue("f_zhinajin", f_zhinajin, true); go.SetPropertyValue("lastinputdate", DateTime.Parse(json["lastinputdate"]), false); go.SetPropertyValue("lastrecord", (decimal)json["lastrecord"], false); go.SetPropertyValue("f_endjfdate", DateTime.Parse(json["f_endjfdate"]), false); go.SetPropertyValue("f_zhinajintianshu", (int)json["days"], false); go.SetPropertyValue("f_network", (string)json["f_network"], false); go.SetPropertyValue("f_operator", (string)json["f_operator"], false); go.SetPropertyValue("f_inputdate", DateTime.Parse(json["f_inputdate"]), false); go.SetPropertyValue("f_userid", (string)json["f_userid"], false); go.SetPropertyValue("f_stair1amount", (decimal)json["f_stair1amount"], false); go.SetPropertyValue("f_stair1price", (decimal)json["f_stair1price"], false); go.SetPropertyValue("f_stair1fee", (decimal)json["f_stair1fee"], false); go.SetPropertyValue("f_stair2amount", (decimal)json["f_stair2amount"], false); go.SetPropertyValue("f_stair2price", (decimal)json["f_stair2price"], false); go.SetPropertyValue("f_stair2fee", (decimal)json["f_stair2fee"], false); go.SetPropertyValue("f_stair3amount", (decimal)json["f_stair3amount"], false); go.SetPropertyValue("f_stair3price", (decimal)json["f_stair3price"], false); go.SetPropertyValue("f_stair3fee", (decimal)json["f_stair3fee"], false); go.SetPropertyValue("number", (decimal)json["number"], false); list.Add(go); } dataGrid1.ItemsSource = list; // 计算出来的总气量等放到用户界面上 ui_pregas.Text = gasSum.ToString("0.#");//总气量 ui_lastinputgasnum.Text = lastnum.ToString("0.#");//总上期底数 ui_lastrecord.Text = (lastnum + gasSum).ToString("0.#");//总本期底数 ui_zhinajin.Text = zhinajinAll.ToString("0.##");//总滞纳金 ui_linshizhinajin.Text = zhinajinAll.ToString("0.##");//滞纳金 ui_preamount.Text = feeSum.ToString("0.##");//气费金额 decimal f_totalcost = feeSum - f_zhye + zhinajinAll > 0 ? feeSum - f_zhye + zhinajinAll : 0; ui_totalcost.Text = f_totalcost.ToString("0.##");//应缴金额 decimal f_benqizhye = (decimal)(f_zhye - feeSum - zhinajinAll > 0 ? f_zhye - feeSum - zhinajinAll : 0); ui_benqizhye.Text = f_benqizhye.ToString("0.##");//本期结余 shoukuan.Text = f_totalcost.ToString("0.##"); }