private bool getShengXinInfoByShengXinNo() { string shengXinNo = shengXinNoEcTabTextBox.Text; if (shengXinNo.IsNullOrEmpty()) { MessageBox.Show("运单号不可为空"); } else { //MessageBox.Show( ShengXinAPI.getSagawaLableByShengXinNo(shengXinNo)); CargoDetail cargoDtail = ShengXinAPI.getCargoDetailEc(shengXinNo); if (cargoDtail != null) { //cargoWeightTextBox.Text = cargoDtail.weight; cargoHeightTextBox.Text = cargoDtail.height; cargoLengthTextBox.Text = cargoDtail.length; cargoWidthTextBox.Text = cargoDtail.width; return(true); } else { MessageBox.Show("未查到该单号任何信息!"); } } return(false); }
private bool postWeightTabData() { //设定仅打印按钮 By Zhangsong if (onlyPrintCheckBoxEc.CheckState == CheckState.Checked) { return(true); } Console.WriteLine(cargoWeightTextBox.Text); CargoDetail cargoDetail = new CargoDetail() { weight = cargoWeightTextBox.Text.Trim(), height = cargoHeightTextBox.Text.Trim(), width = cargoWidthTextBox.Text.Trim(), length = cargoLengthTextBox.Text.Trim() }; string shengXinNo = shengXinNoEcTabTextBox.Text.Trim(); if (cargoDetail.isNull() || string.IsNullOrEmpty(shengXinNo)) { MessageBox.Show("请检查是否有空项!"); } else { bool flag = ShengXinAPI.postCargoInfoEc(cargoDetail, shengXinNo); if (!flag) { MessageBox.Show("更新货物信息失败!"); } else { return(true); } } return(false); }
public static bool postCargoInfoEc(CargoDetail cargoDetail, string shengXinNo) { Dictionary <string, object> postData = new Dictionary <string, object>(); postData.Add("shengxinNo", shengXinNo); postData.Add("weight", cargoDetail.weight); postData.Add("length", cargoDetail.length); postData.Add("width", cargoDetail.width); postData.Add("height", cargoDetail.height); postData.Add("type", "EC"); string data = ApiHelper.Post("/sxn/eb/updateWeightAndSizeForEc", postData); //System.Diagnostics.Debug.WriteLine(data); Dictionary <string, object> result = ApiHelper.DeserializeJson <Dictionary <string, object> >(data); if (result["success"] != null && (bool)result["success"]) { return(true); } return(false); }