Esempio n. 1
0
 /// <summary>
 /// 保存运单信息
 /// </summary>
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (CheckInput())
     {
         try
         {
             string number      = txtOrderNumber.Text.Trim();
             int    sId         = Convert.ToInt32(cboSenderCustomer.SelectedValue);
             string sOrg        = cboSenderCustomer.Text.Trim();
             string sPerson     = txtSenderName.Text.Trim();
             string sTel        = txtSenderPhone.Text.Trim();
             string sAddress    = cboSenderPId.Text + cboSenderCId.Text + txtSenderAddress.Text.Trim();
             string rId         = cboReceiverCustomer.SelectedIndex < 1 ? "NULL" : cboReceiverCustomer.SelectedValue.ToString();
             string rOrg        = cboReceiverCustomer.Text.Trim();
             string rPerson     = txtReceiverName.Text.Trim();
             string rTel        = txtReceiverPhone.Text.Trim();
             string rAddress    = cboReceiverPId.Text + cboReceiverCId.Text + txtReceiverAddress.Text.Trim();
             int    bCount      = (int)nudCount.Value;
             string storageName = Common._StorageName;
             WaybillServer.AddOrder(number, sId, sOrg, sPerson, sTel, sAddress, rId, rOrg, rPerson, rTel, rAddress, bCount, storageName);
             MessageBox.Show("添加成功,您可以继续扫码添加!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
             txtOrderNumber.Text = string.Empty;
             txtOrderNumber.Focus();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "创建运单失败", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
         }
     }
 }
Esempio n. 2
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     FrmParent.ParentForm.ResetReturnDelay();
     if (CheckInput() && FrmParent.ParentForm._UCRecevInfo.CheckInput() && FrmParent.ParentForm._UCSenderInfo.CheckInput())
     {
         string   saveErr   = string.Empty;
         string   content   = string.Empty;
         DateTime orderTime = DateTime.Now;
         try
         {
             string number = txtOrderNumber.Text.Trim();
             FrmParent.ParentForm.CheckNumber(number, false);
             Customer sc          = FrmParent.ParentForm._UCSenderInfo._CustomerInfo;
             Customer rc          = FrmParent.ParentForm._UCRecevInfo._CustomerInfo;
             int      sId         = (int)sc.Id;                             // Convert.ToInt32(cboSenderCustomer.SelectedValue);
             string   sOrg        = sc.FullName;                            // cboSenderCustomer.Text.Trim();
             string   sPerson     = sc.ContactPerson;                       // txtSenderName.Text.Trim();
             string   sTel        = sc.ContactTel;                          // txtSenderPhone.Text.Trim();
             string   sAddress    = sc.ContactAddress;                      // cboSenderPId.Text + cboSenderCId.Text + txtSenderAddress.Text.Trim();
             string   rId         = rc.Id == 0 ? "NULL" : rc.Id.ToString(); // cboReceiverCustomer.SelectedIndex < 1 ? "NULL" : cboReceiverCustomer.SelectedValue.ToString();
             string   rOrg        = rc.FullName;                            // cboReceiverCustomer.Text.Trim();
             string   rPerson     = rc.ContactPerson;                       // txtReceiverName.Text.Trim();
             string   rTel        = rc.ContactTel;                          // txtReceiverPhone.Text.Trim();
             string   rAddress    = rc.ContactAddress;                      // cboReceiverPId.Text + cboReceiverCId.Text + txtReceiverAddress.Text.Trim();
             int      bCount      = (int)nudCount.Value;
             string   storageName = Common._StorageName;
             orderTime = WaybillServer.AddOrder(number, sId, sOrg, sPerson, sTel, sAddress, rId, rOrg, rPerson, rTel, rAddress, bCount, storageName, Common._Destination, ref content);
             FrmParent.ParentForm.EndSleep();
         }
         catch (Exception ex)
         {
             saveErr = ex.Message;
             MessageBox.Show(ex.Message, "创建运单失败", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
         }
         finally
         {
             txtOrderNumber.Focus();
             Common.SaveOptRecord(saveErr == string.Empty ? "创建运单成功" : ("创建运单失败:" + saveErr), content, orderTime, txtOrderNumber.Text.Trim(), 0);
             if (saveErr == string.Empty)
             {
                 FrmParent.ParentForm.AddScanNum(txtOrderNumber.Text.Trim(), false);
                 MessageBox.Show("添加成功,您可以继续扫码添加!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
             }
             txtOrderNumber.Text = string.Empty;
         }
     }
 }