public V1Info GetV1Info(string voyageNo, string sType, string tradeCode) { V1Info info = new V1Info(); if (sType.Equals("普货", StringComparison.CurrentCultureIgnoreCase) || sType.Equals("D", StringComparison.CurrentCultureIgnoreCase)) { return(info); } //string sql = "select count(1) from " + v1Head + " where voyage_no=@voyage_no and ENTRY_TYPE=@Trade_Type"; Hashtable ht = new Hashtable(); ht["voyage_no"] = voyageNo; ht["ENTRY_TYPE"] = sType; //int ticket = comm2.GetIntData(sql, ht); //info.Ticket = ticket; string sql = "select count(1) allcount, ISNULL(SUM(PACK_NO),0) packno,ISNULL(SUM(GROSS_WT),0) wt from " + v1Head + " where VOYAGE_NO=@voyage_no and ENTRY_TYPE=@ENTRY_TYPE"; string newConnstr = tradeCode.Equals(DUNHAOTradeCode, StringComparison.CurrentCultureIgnoreCase) ? DUNHAOconnstring : connstring2; DbHelperSQL.connectionString = newConnstr; DataRow dr = comm.GetOneRow(sql, ht); if (dr != null) { info.PackNo = Convert.ToInt32(dr["packno"]); info.Weight = Convert.ToDouble(dr["wt"]); info.Ticket = Convert.ToInt32(dr["allcount"]); } DbHelperSQL.connectionString = defaultConnString; return(info); }
private void DuiPeng(DataGridViewRow dr) { string voyageNo = dr.Cells["VoyageNo"].Value.ToString(); string tradeType = dr.Cells["TradeType"].Value.ToString(); string comId = dr.Cells["CompanyId"].Value.ToString(); V1Info info = bll.DuiPeng(voyageNo, tradeType, comId); dr.Cells["Ticket_C"].Value = info.Ticket; dr.Cells["Piece_C"].Value = info.PackNo; dr.Cells["Weight_C"].Value = info.Weight; MessageBox.Show("对碰成功"); }
public V1Info DuiPeng(string voyageNo, string sType, string tradeCode) { V1Info vinfo = GetV1Info(voyageNo, sType, tradeCode); string sql = "update InputWork set Ticket_C=@Ticket_C,Piece_C=@Piece_C,Weight_C=@Weight_C where VoyageNo=@VoyageNo and TradeType=@TradeType"; Hashtable ht = new Hashtable(); ht["Ticket_C"] = vinfo.Ticket; ht["Piece_C"] = vinfo.PackNo; ht["Weight_C"] = vinfo.Weight; ht["VoyageNo"] = voyageNo; ht["TradeType"] = sType; comm.UID(sql, ht); return(vinfo); }
private void btnConfirm_Click(object sender, EventArgs e) { if (CheckData()) { ChangeConfirmButton(false); IList <Hashtable> paramsList = new List <Hashtable>(); Hashtable ht = null; int id = 0; string sType = ""; string voyageNo = txtVoyageNo.Text.Trim(); int ticket = 0; int piece = 0; double weight = 0; for (int i = 0; i < 4; i++) { ticket = StringHelper.SafeGetIntFromObj(this.superGrid1.Rows[i].Cells["Ticket"].Value); piece = StringHelper.SafeGetIntFromObj(this.superGrid1.Rows[i].Cells["Piece"].Value); weight = StringHelper.SafeGetDoubleFromObj(this.superGrid1.Rows[i].Cells["Weight"].Value); if (ticket == 0 && piece == 0 && weight == 0) { continue; } id = StringHelper.SafeGetIntFromObj(this.superGrid1.Rows[i].Cells["id"].Value); ht = new Hashtable(); ht["id"] = id; ht["Ticket"] = ticket; ht["Piece"] = piece; ht["Weight"] = weight; ht["Price"] = StringHelper.SafeGetDecimalFromObj(this.superGrid1.Rows[i].Cells["Price"].Value); ht["Remark"] = this.superGrid1.Rows[i].Cells["Remark"].Value.ToString(); sType = GetTradeType(i); ht["TradeType"] = sType; if (id <= 0) { if (editCompanyInfo != null) { ht["CompanyId"] = editCompanyInfo.CompanyId; ht["CompanyName"] = editCompanyInfo.CompanyName; ht["CompanyShortName"] = editCompanyInfo.CompanyShortName; } else { ht["CompanyId"] = GlobalVariable.LoginUserInfo.CompanyId; ht["CompanyName"] = GlobalVariable.LoginUserInfo.CompanyName; ht["CompanyShortName"] = GlobalVariable.LoginUserInfo.CompanyShortName; } ht["AddUserId"] = GlobalVariable.LoginUserInfo.id; ht["AddUserName"] = GlobalVariable.LoginUserInfo.UserName; ht["VoyageNo"] = voyageNo; ht["A_L_TYPE"] = rbA.Checked ? "A" : "L"; ht["I_E_FLAG"] = rbI.Checked ? "I" : "E"; ht["InputDate"] = stime.Value; ht["addIP"] = NetHelper.GetLocalIP(); } else { ht["SNo"] = this.superGrid1.Rows[i].Cells["SNo"].Value.ToString(); ht["ModifyUserId"] = GlobalVariable.LoginUserInfo.id; ht["ModifyUserName"] = GlobalVariable.LoginUserInfo.UserName; ht["ModifyIp"] = NetHelper.GetLocalIP(); ht["Modifytime"] = DateTime.Now; } V1Info headInfo = bll.GetV1Info(voyageNo, sType, GlobalVariable.LoginUserInfo.CompanyId); ht["Ticket_C"] = headInfo.Ticket; ht["Piece_C"] = headInfo.PackNo; ht["Weight_C"] = headInfo.Weight; ht["Price_C"] = 0; paramsList.Add(ht); } IList <string> newSNOList = new List <string>(); int rs = bll.SaveInputData(paramsList, ref newSNOList); if (rs > 0) { if (!string.IsNullOrEmpty(_editVoyageNo)) { this.DialogResult = DialogResult.OK; this.Close(); return; } ShowNewSNO(newSNOList); MessageBox.Show("保存成功,共更新" + rs + "笔数据"); // ClearData(true); txtVoyageNo.Text = ""; txtVoyageNo.Focus(); } else { MessageBox.Show("保存失败"); } } }