public void CheckPDSheet(string sheet_no) { var db = new DB.DBByHandClose(Appsetting.conn); DB.IDB d = db; try { db.Open(); db.BeginTran(); ic_t_check_master master = d.ExecuteToModel <ic_t_check_master>("select * from ic_t_check_master where sheet_no='" + sheet_no + "'", null); if (master == null || string.IsNullOrEmpty(master.sheet_no)) { throw new Exception("单据:[" + sheet_no + "]不存在"); } if (!master.approve_flag.Equals("0")) { throw new Exception("单据:[" + sheet_no + "]已审核"); } master.approve_flag = "1"; d.Update(master, "sheet_no", "approve_flag"); // db.CommitTran(); } catch (Exception ex) { Log.writeLog("CheckBLL.CheckPDSheet()", ex.ToString(), sheet_no); db.RollBackTran(); throw ex; } finally { db.Close(); } }
void IOrder.Save() { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // if (txtbranch.Text.Trim().Contains("/") == false) { MsgForm.ShowFrom("机构必填!"); return; } if (txtoper_date.Text.Trim() == "") { MsgForm.ShowFrom("单据日期必填!"); return; } if (string.IsNullOrEmpty(this.txt_check_no.Text)) { this.txtsheet_no.Focus(); MsgForm.ShowFrom("请选择批次单"); return; } ic_t_check_master ord = new ic_t_check_master(); List <ic_t_check_detail> lines = new List <ic_t_check_detail>(); ord.sheet_no = txtsheet_no.Text.Trim(); ord.branch_no = txtbranch.Text.Trim().Split('/')[0]; ord.check_no = txt_check_no.Text.Trim(); ord.oper_date = Helper.Conv.ToDateTime(txtoper_date.Text.Trim()); ord.oper_id = txtoper_man.Text.Split('/')[0]; ord.deal_man = txt_deal_man.Text.Split('/')[0]; ord.cm_branch = "00"; ord.meno = txt_memo.Text.Trim(); ord.update_time = update_time; ord.check_no = this.txt_check_no.Text; int flag = 0; int index = 0; foreach (DataRow row in editGrid1.DataSource.Rows) { ++index; if (row["item_no"].ToString() != "") { ic_t_check_detail line = new ic_t_check_detail(); lines.Add(line); line.sheet_no = ord.sheet_no; line.item_no = row["item_no"].ToString(); line.in_price = Helper.Conv.ToDecimal(row["in_price"].ToString()); line.sale_price = Helper.Conv.ToDecimal(row["sale_price"].ToString()); line.stock_qty = Helper.Conv.ToDecimal(row["stock_qty"].ToString()); line.real_qty = Helper.Conv.ToDecimal(row["real_qty"].ToString()); line.balance_qty = Helper.Conv.ToDecimal(row["balance_qty"].ToString()); line.memo = ""; line.other1 = ""; line.other2 = ""; line.num1 = 0; line.num2 = 0; line.num3 = 0; line.packqty = Helper.Conv.ToInt(row["packqty"].ToString()); line.sgqty = Helper.Conv.ToDecimal(row["sgqty"].ToString()); flag = 1; } } if (flag == 0) { MsgForm.ShowFrom("请输入表单明细"); return; } IBLL.ICheckBLL bll = new BLL.CheckBLL(); if (runType == 1) { var sheet_no = ""; bll.AddCheckSheet(ord, lines, out sheet_no); IOrder ins = this; ins.ShowOrder(sheet_no); } else if (runType == 2) { bll.ChangeCheckSheet(ord, lines); IOrder ins = this; ins.ShowOrder(ord.sheet_no); } Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Helper.Conv.ControlsAdds(this, dic); MsgForm.ShowFrom("保存成功"); } catch (Exception ex) { Helper.LogHelper.writeLog("frmCheckSheet->Save()", ex.ToString(), txtsheet_no.Text); MsgForm.ShowFrom("库存盘点表保存异常[" + ex.Message + "]"); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }