private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (sheet_no != null && sheet_no != "") { if (YesNoForm.ShowFrom("确认删除单据[" + sheet_no + "]?") == System.Windows.Forms.DialogResult.Yes) { IBLL.ICheckBLL bll = new BLL.CheckBLL(); bll.DeleteCheckSheet(sheet_no, update_time); IOrder ins = this; ins.Add(); } } } catch (Exception ex) { MsgForm.ShowFrom("删除单据异常[" + ex.Message + "]"); Helper.LogHelper.writeLog("frmCheckSheet->tsbDel_Click()", ex.ToString(), sheet_no); } }
private void btnSelect_Click(object sender, EventArgs e) { Model.ic_t_check_init init = new Model.ic_t_check_init() { branch_no = this.txtBranch.Text.Split('/')[0], create_time = Conv.ToDateTime(this.txtStartTime.Text) }; Thread th = new Thread(() => { Cursor.Current = Cursors.WaitCursor; Helper.GlobalData.windows.ShowLoad(this); try { IBLL.ICheckBLL bll = new BLL.CheckBLL(); var tb = bll.GetCheckInitSheets(init); this.dgv.Invoke((MethodInvoker) delegate { this.dgv.DataSource = tb; }); } catch (Exception ex) { LogHelper.writeLog("btnSelect_Click", ex.ToString()); MsgForm.ShowFrom(ex); } Cursor.Current = Cursors.Default; Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); }
private void btnSelect_Click(object sender, EventArgs e) { IBLL.ICheckBLL bll = new BLL.CheckBLL(); var dt = bll.GetCheckInitSheets(new Model.ic_t_check_init() { check_status = "0" }); frmSelect frm = new frmSelect(); frm.dgv.AddColumn("sheet_no", "批次号", "", 110, 1, ""); frm.dgv.AddColumn("仓库", "仓库", "", 120, 1, ""); frm.dgv.AddColumn("begin_date", "开始日期", "", 100, 1, "yyyy-MM-dd"); frm.dgv.AddColumn("操作员", "操作员", "", 100, 1, ""); frm.dgv.AddColumn("memo", "备注", "", 150, 1, ""); frm.dgv.AddColumn("商品类别", "商品类别", "", 110, 1, ""); frm.Text = "选择盘点批次"; frm.tb = dt; this.txtSheet_no.Text = frm.SelectData("批次号:", "sheet_no"); SendKeys.Send("{Tab}"); if (!string.IsNullOrEmpty(this.txtSheet_no.Text)) { IOrder order = this; order.ShowOrder(this.txtSheet_no.Text); } }
private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (this.dataGrid1.CurrentRow() != null) { string sheet_no = this.dataGrid1.CurrentRow()["sheet_no"].ToString(); if (YesNoForm.ShowFrom("确认删除单据" + sheet_no + "?") == DialogResult.Yes) { IBLL.ICheckBLL bll = new BLL.CheckBLL(); bll.DeleteCheckSheet(sheet_no, update_time); var tb = this.dataGrid1.DataSource; tb.Rows.Remove(this.dataGrid1.CurrentRow()); this.dataGrid2.DataSource = new DataTable(); this.dataGrid1.Refresh(); } } } catch (Exception ex) { MsgForm.ShowFrom(ex); Helper.LogHelper.writeLog("frmCheckSheetList->tsbDel_Click()", ex.ToString()); } }
private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (this.dgv.CurrentRow() != null) { string sheet_no = this.dgv.CurrentRow()["sheet_no"].ToString(); if (YesNoForm.ShowFrom("确认删除单据" + sheet_no + "?") == DialogResult.Yes) { IBLL.ICheckBLL bll = new BLL.CheckBLL(); bll.DeleteChectInitSheet(new Model.ic_t_check_init() { sheet_no = sheet_no, update_time = DateTime.Now }); var tb = this.dgv.DataSource; tb.Rows.Remove(this.dgv.CurrentRow()); this.dgv.Refresh(); } } } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
void IOrder.Save() { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // if (string.IsNullOrEmpty(txtBranch.Text)) { MsgForm.ShowFrom("请选择仓库!"); this.txtBranch.Focus(); return; } ic_t_check_init init = new ic_t_check_init() { sheet_no = this.txtSheet_no.Text, check_status = "0", approve_flag = "0", begin_date = DateTime.Now, branch_no = this.txtBranch.Text.Split('/')[0], oper_id = this.txtOper.Text.Split('/')[0], create_time = DateTime.Now, item_clsno = this.txtItemCls.Text.Split('/')[0], memo = this.txtMemo.Text, update_time = DateTime.Now, }; if (runType == 1) { IBLL.ICheckBLL bll = new BLL.CheckBLL(); string sheet_no = ""; bll.AddChectInitSheet(init, out sheet_no); IOrder ins = this; ins.ShowOrder(sheet_no); } else if (runType == 2) { IBLL.ICheckBLL bll = new BLL.CheckBLL(); bll.UpdateChectInitSheet(init); IOrder ins = this; ins.ShowOrder(init.sheet_no); } Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Conv.ControlsAdds(this, dic); MsgForm.ShowFrom("保存成功"); } catch (Exception ex) { MsgForm.ShowFrom(ex); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
private void txtbranch_Leave(object sender, EventArgs e) { var branch_no = txtbranch.Text.Trim().Split('/')[0]; if (branch_no != "") { IBLL.ICheckBLL bll = new BLL.CheckBLL(); stock_dt = bll.GetBranchStockList(branch_no); } }
private void tsbCheck_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "05")) { return; } if (string.IsNullOrEmpty(this.txtSheet_no.Text)) { return; } IBLL.ICheckBLL bll = new BLL.CheckBLL(); Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; if (!Conv.ControlsCom(this, dic)) { List <Model.ic_t_check_finish> lis = new List <Model.ic_t_check_finish>(); foreach (DataRow r in this.editGrid1.DataSource.Rows) { ic_t_check_finish item = new ic_t_check_finish() { sheet_no = this.txtSheet_no.Text, item_no = r["item_no"].ToString(), change_flag = r["change_flag"].ToString(), memo = r["memo"].ToString(), update_time = DateTime.Now }; lis.Add(item); } if (lis.Count > 0) { bll.UpdateCheckFinish(lis); } } bll.CheckPCSheet(new ic_t_check_init() { sheet_no = this.txtSheet_no.Text, memo = this.txtMemo.Text, approve_man = this.txtApproveMan.Text.Split('/')[0], end_date = DateTime.Now, }); IOrder order = this; order.ShowOrder(this.txtSheet_no.Text); MsgForm.ShowFrom("审核成功"); } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void tsbCheck_Click(object sender, EventArgs e) { if (!MyLove.PermissionsBalidation(this.Text, "05")) { return; } if (string.IsNullOrEmpty(this.txtsheet_no.Text)) { return; } IBLL.ICheckBLL bll = new BLL.CheckBLL(); bll.CheckPDSheet(this.txtsheet_no.Text); MsgForm.ShowFrom("审核成功"); }
public void GetPrintTb() { if (string.IsNullOrEmpty(this.txtsheet_no.Text)) { throw new Exception("请选择单据!"); } IBLL.ICheckBLL bll = new BLL.CheckBLL(); DataTable tb1; DataTable tb2; bll.GetCheckSheet(this.txtsheet_no.Text, out tb1, out tb2); PrintForm.PrintHelper.tb_main = tb1; PrintForm.PrintHelper.tb_detail = tb2; }
private void dgv_ClickCell(object sender, string column_name, DataRow row, MouseEventArgs e) { try { Thread th = new Thread(() => { Cursor.Current = Cursors.WaitCursor; Helper.GlobalData.windows.ShowLoad(this); try { IBLL.ICheckBLL bll = new BLL.CheckBLL(); DataTable tb = bll.GetCheckFinish(new Model.ic_t_check_finish() { sheet_no = row["sheet_no"].ToString() }); this.dgvDetail.Invoke((MethodInvoker) delegate { this.dgvDetail.DataSource.Rows.Clear(); foreach (DataRow dr in tb.Rows) { this.dgvDetail.DataSource.ImportRow(dr); var r = this.dgvDetail.DataSource.Rows[this.dgvDetail.DataSource.Rows.Count - 1]; r["盈亏数"] = Conv.ToDecimal(r["real_qty"]) - Conv.ToDecimal(r["stock_qty"]); r["进价盈亏金额"] = Conv.ToDecimal(r["price"]) * Conv.ToDecimal(r["盈亏数"]); r["售价盈亏金额"] = Conv.ToDecimal(r["sale_price"]) * Conv.ToDecimal(r["盈亏数"]); r["售价盘点金额"] = Conv.ToDecimal(r["sale_price"]) * Conv.ToDecimal(r["real_qty"]); } this.dgvDetail.Refresh(); }); } catch (Exception ex) { LogHelper.writeLog("SysSetting_Load", ex.ToString()); MsgForm.ShowFrom(ex); } Cursor.Current = Cursors.Default; Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void tsbCheck_Click(object sender, EventArgs e) { if (!MyLove.PermissionsBalidation(this.Text, "05")) { return; } if (dataGrid1.CurrentRow() == null) { return; } string sheet_no = dataGrid1.CurrentRow()["sheet_no"].ToString(); IBLL.ICheckBLL bll = new BLL.CheckBLL(); bll.CheckPDSheet(sheet_no); btnSelect_Click(null, null); }
public void GetPrintTb() { if (string.IsNullOrEmpty(this.txtSheet_no.Text)) { throw new Exception("请选择单据!"); } IBLL.ICheckBLL bll = new BLL.CheckBLL(); var tb1 = bll.GetCheckInitSheets(new Model.ic_t_check_init() { sheet_no = this.txtSheet_no.Text }); var tb2 = bll.GetCheckFinish(new Model.ic_t_check_finish() { sheet_no = this.txtSheet_no.Text }); PrintForm.PrintHelper.tb_main = tb1; PrintForm.PrintHelper.tb_detail = tb2; }
private void dataGrid1_CurrentCellChange(object sender, string column_name, DataRow row) { try { if (sheet_no != row["sheet_no"].ToString()) { sheet_no = row["sheet_no"].ToString(); IBLL.ICheckBLL bll = new BLL.CheckBLL(); System.Data.DataTable tb1; System.Data.DataTable tb2; bll.GetCheckSheet(sheet_no, out tb1, out tb2); this.dataGrid2.DataSource = tb2; update_time = Helper.Conv.ToDateTime(tb1.Rows[0]["update_time"]); } } catch (Exception ex) { MsgForm.ShowFrom(ex); Helper.LogHelper.writeLog("frmCheckSheetList->dataGrid1_CurrentCellChange()", ex.ToString()); } }
private void tsbDel_Click(object sender, EventArgs e) { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (string.IsNullOrEmpty(this.txtSheet_no.Text)) { return; } if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes) { IBLL.ICheckBLL bll = new BLL.CheckBLL(); bll.DeleteChectInitSheet(new ic_t_check_init() { sheet_no = this.txtSheet_no.Text, update_time = DateTime.Now }); IOrder order = this; order.Add(); } }
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; } }
void IOrder.ShowOrder(string sheet_no) { try { Thread th = new Thread(() => { Cursor.Current = Cursors.WaitCursor; Helper.GlobalData.windows.ShowLoad(this); try { IBLL.ICheckBLL bll = new BLL.CheckBLL(); Model.ic_t_check_init init = bll.GetCheckInitSheet(new Model.ic_t_check_init() { sheet_no = sheet_no }); this.Invoke((MethodInvoker) delegate { this.txtSheet_no.Text = sheet_no; this.txtapproveDate.Text = ""; this.txtApproveMan.Text = Program.oper.oper_id + "/" + Program.oper.oper_name; this.txtBranch.Text = init.branch_no; this.txtMemo.Text = init.memo; this.txtOper.Text = init.oper_id; this.txtStartTime.Text = init.begin_date.ToString("yyyy-MM-dd HH:mm:ss"); this.txtStatus.Text = init.check_status.Equals("0") ? "开始盘点" : "结束盘点"; if (init.approve_flag.Equals("1")) { this.txtapproveDate.Text = init.approve_date.ToString("yyyy-MM-dd HH:mm:ss"); this.txtApproveMan.Text = init.approve_man; this.txtEndTime.Text = init.end_date.ToString("yyyy-MM-dd HH:mm:ss"); } }); DataTable tb = bll.GetCheckFinish(new Model.ic_t_check_finish() { sheet_no = sheet_no }); this.editGrid1.DataSource.Rows.Clear(); this.Invoke((MethodInvoker) delegate { foreach (DataRow dr in tb.Rows) { this.editGrid1.DataSource.ImportRow(dr); var r = this.editGrid1.DataSource.Rows[this.editGrid1.DataSource.Rows.Count - 1]; r["盈亏数"] = Conv.ToDecimal(r["real_qty"]) - Conv.ToDecimal(r["stock_qty"]); r["进价盈亏金额"] = Conv.ToDecimal(r["price"]) * Conv.ToDecimal(r["盈亏数"]); r["售价盈亏金额"] = Conv.ToDecimal(r["sale_price"]) * Conv.ToDecimal(r["盈亏数"]); r["售价盘点金额"] = Conv.ToDecimal(r["sale_price"]) * Conv.ToDecimal(r["real_qty"]); } this.editGrid1.Refresh(); Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Helper.Conv.ControlsAdds(this, dic); }); } catch (Exception ex) { LogHelper.writeLog("ShowOrder", ex.ToString()); MsgForm.ShowFrom(ex); } Cursor.Current = Cursors.Default; Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void refreshData() { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // DateTime date1 = Helper.Conv.ToDateTime(dateTextBox1.Text.Trim()); DateTime date2 = Helper.Conv.ToDateTime(dateTextBox2.Text.Trim()); Thread th = new Thread(() => { Helper.GlobalData.windows.ShowLoad(this); try { IBLL.ICheckBLL bll = new BLL.CheckBLL(); if (date1 == DateTime.MinValue) { throw new Exception("期间不正确"); } if (date2 == DateTime.MinValue) { throw new Exception("期间不正确"); } DataTable tb = bll.GetCheckSheetList(date1, date2); this.dataGrid1.Invoke((MethodInvoker) delegate { this.dataGrid1.DataSource = tb; if (tb.Rows.Count > 0) { sheet_no = tb.Rows[0]["sheet_no"].ToString(); IBLL.ICheckBLL cbll = new BLL.CheckBLL(); System.Data.DataTable tb1; System.Data.DataTable tb2; cbll.GetCheckSheet(sheet_no, out tb1, out tb2); this.dataGrid2.DataSource = tb2; update_time = Helper.Conv.ToDateTime(tb1.Rows[0]["update_time"]); } else { this.dataGrid2.DataSource = new DataTable(); } }); } catch (Exception ex) { LogHelper.writeLog("refreshData", ex.ToString()); MsgForm.ShowFrom(ex); } Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); } catch (Exception ex) { MsgForm.ShowFrom(ex); Helper.LogHelper.writeLog("frmCheckSheetList->refreshData()", ex.ToString()); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
void IOrder.ShowOrder(string sheet_no) { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // RunType = 2; IBLL.ICheckBLL bll = new BLL.CheckBLL(); DataTable tb1; DataTable tb2; bll.GetCheckSheet(sheet_no, out tb1, out tb2); // var r1 = tb1.Rows[0]; update_time = Helper.Conv.ToDateTime(r1["update_time"]); this.sheet_no = sheet_no; if (r1["branch_no"].ToString() == "") { txtbranch.Text = ""; } else { txtbranch.Text = r1["branch_no"].ToString() + "/" + r1["branch_name"].ToString(); } txtsheet_no.Text = r1["sheet_no"].ToString(); txtoper_date.Text = Helper.Conv.ToDateTime(r1["oper_date"].ToString()).ToString("yyyy-MM-dd"); if (r1["deal_man"].ToString() == "") { txt_deal_man.Text = ""; } else { txt_deal_man.Text = r1["deal_man"].ToString() + "/" + r1["deal_man_name"].ToString(); } if (r1["oper_id"].ToString() == "") { txtoper_man.Text = ""; } else { txtoper_man.Text = r1["oper_id"] + "/" + r1["oper_name"]; } txt_check_no.Text = r1["check_no"].ToString(); txt_memo.Text = r1["meno"].ToString(); this.txtStatus.Text = r1["approve_flag"].ToString().Equals("0") ? "未审核" : "已审核"; // editGrid1.DataSource = tb2; Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Helper.Conv.ControlsAdds(this, dic); } catch (Exception ex) { MsgForm.ShowFrom("库存盘点表异常[" + ex.Message + "]"); Helper.LogHelper.writeLog("frmCheckSheet->ShowOrder()", ex.ToString(), sheet_no); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
private void editGrid1_DoubleClickCell(object sender, string column_name, DataRow row, MouseEventArgs e) { if (column_name.Equals("item_subno")) { if (string.IsNullOrEmpty(this.txt_check_no.Text)) { this.txtsheet_no.Focus(); MsgForm.ShowFrom("请选择批次单"); return; } if (string.IsNullOrEmpty(this.txtbranch.Text)) { this.txtbranch.Focus(); MsgForm.ShowFrom("请选择仓库"); return; } IBLL.ICheckBLL bll = new BLL.CheckBLL(); var tbgoods = bll.GetCheckItemBak(new ic_t_check_bak() { sheet_no = this.txt_check_no.Text, branch_no = this.txtbranch.Text.Split('/')[0] }); frmSelect frm = new frmSelect(); frm.dgv.AddColumn("选择", "选择", "", 40, 2, "{0:,1:√}"); frm.dgv.AddColumn("item_no", "商品编号", "", 110, 1, ""); frm.dgv.AddColumn("item_subno", "货号", "", 110, 1, ""); frm.dgv.AddColumn("barcode", "条码", "", 110, 1, ""); frm.dgv.AddColumn("item_name", "商品名称", "", 160, 1, ""); frm.dgv.AddColumn("item_subname", "拼音码", "", 90, 1, ""); frm.dgv.AddColumn("unit_no", "单位", "", 60, 1, ""); frm.dgv.AddColumn("item_size", "规格", "", 60, 1, ""); frm.dgv.AddColumn("price", "价格", "", 100, 3, "0.00"); frm.dgv.AddColumn("product_area", "产地", "", 150, 1, ""); frm.Text = "选择商品"; frm.tb = tbgoods; List <DataRow> lis = frm.SelectDataRow("货号:", "item_subno"); int index = 0; for (int i = 0; i < this.editGrid1.DataSource.Rows.Count; i++) { if (this.editGrid1.DataSource.Rows[i] == row) { index = i; } } if (lis.Count > 1) { for (int i = 0; i < lis.Count - 1; i++) { this.editGrid1.DataSource.Rows.InsertAt(this.editGrid1.DataSource.NewRow(), index); } } foreach (DataRow dr in lis) { var dgv_tb = this.editGrid1.DataSource.Copy(); dgv_tb.ImportRow(dr); var dgv_dr = dgv_tb.Rows[dgv_tb.Rows.Count - 1]; dgv_dr["real_qty"] = dgv_dr["stock_qty"]; dgv_dr["item_pack"] = "0.00"; dgv_dr["packqty"] = dgv_dr["real_qty"]; dgv_dr["sgqty"] = "0.00"; dgv_dr["sgqty"] = "0.00"; dgv_dr["balance_qty"] = "0.00"; dgv_dr["real_amount"] = "0.00"; dgv_dr["in_price"] = dr["price"]; Conv.CopyDataRow(this.editGrid1.DataSource, index, dgv_dr); index++; } this.editGrid1.Editing = false; this.editGrid1.Refresh(); } }
private void editGrid1_CellEndEdit(object sender, string column_name, DataRow row) { if (column_name == "barcode" || column_name == "item_subno") { if (string.IsNullOrEmpty(this.txt_check_no.Text)) { this.txtsheet_no.Focus(); MsgForm.ShowFrom("请选择批次单"); return; } if (string.IsNullOrEmpty(this.txtbranch.Text)) { this.txtbranch.Focus(); MsgForm.ShowFrom("请选择仓库"); return; } if (string.IsNullOrEmpty(row[column_name].ToString())) { return; } IBLL.ICheckBLL bll = new BLL.CheckBLL(); DataTable tb = bll.GetCheckItemBak(new ic_t_check_bak() { sheet_no = this.txt_check_no.Text, branch_no = this.txtbranch.Text.Split('/')[0], item_no = row[column_name].ToString() }); foreach (DataRow dr in tb.Rows) { int index = 0; for (int i = 0; i < this.editGrid1.DataSource.Rows.Count; i++) { if (this.editGrid1.DataSource.Rows[i] == row) { index = i; } } var dgv_tb = this.editGrid1.DataSource.Copy(); dgv_tb.ImportRow(dr); var dgv_dr = dgv_tb.Rows[dgv_tb.Rows.Count - 1]; dgv_dr["real_qty"] = dgv_dr["stock_qty"]; dgv_dr["item_pack"] = "0.00"; dgv_dr["packqty"] = dgv_dr["real_qty"]; dgv_dr["sgqty"] = "0.00"; dgv_dr["sgqty"] = "0.00"; dgv_dr["balance_qty"] = "0.00"; dgv_dr["real_amount"] = "0.00"; dgv_dr["in_price"] = dr["price"]; Conv.CopyDataRow(this.editGrid1.DataSource, index, dgv_dr); break; } if (tb.Rows.Count < 1) { row[column_name] = ""; } } else if (column_name.Equals("real_qty")) { row["balance_qty"] = row["real_qty"].ToDecimal() - row["stock_qty"].ToDecimal(); row["packqty"] = row["balance_qty"]; row["real_amount"] = row["balance_qty"].ToDecimal() * row["in_price"].ToDecimal(); } }
void IServiceBase.Request(string t, string pars, out string res) { try { WebHelper web = new WebHelper(pars); ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars); var kv = r.ToDictionary(); IBLL.ICheckBLL bll = new BLL.CheckBLL(); if (t == "get_checksheet_list") { string date1 = r.Read("date1"); string date2 = r.Read("date2"); var tb = bll.GetCheckSheetList(date1, date2); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("data", tb); res = w.ToString(); } else if (t == "get_check_init_list") { var tb = bll.GetCheckInitList(); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("data", tb); res = w.ToString(); } else if (t == "get_branch_stock_list") { string branch_no = r.Read("branch_no"); var tb = bll.GetBranchStockList(branch_no); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("data", tb); res = w.ToString(); } else if (t == "get_checksheet") { string sheet_no = r.Read("sheet_no"); System.Data.DataTable tb1; System.Data.DataTable tb2; bll.GetCheckSheet(sheet_no, out tb1, out tb2); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("tb1", tb1); w.Append("tb2", tb2); res = w.ToString(); } else if (t == "add_checksheet") { var ord = new Model.ic_t_check_master(); ord.sheet_no = r.Read("sheet_no"); ord.branch_no = r.Read("branch_no"); ord.oper_id = r.Read("oper_id"); ord.oper_date = Helper.Conv.ToDateTime(r.Read("oper_date")); ord.meno = r.Read("meno"); ord.approve_flag = "0"; ord.cm_branch = r.Read("cm_branch"); ord.deal_man = r.Read("deal_man"); ord.max_change = 0; ord.check_no = r.Read("check_no"); List <Model.ic_t_check_detail> lines = new List <Model.ic_t_check_detail>(); foreach (ReadWriteContext.IReadContext r2 in r.ReadList("lines")) { var item = new Model.ic_t_check_detail(); item.sheet_no = r2.Read("sheet_no"); item.item_no = r2.Read("item_no"); item.in_price = Helper.Conv.ToDecimal(r2.Read("in_price")); item.sale_price = Helper.Conv.ToDecimal(r2.Read("sale_price")); item.stock_qty = Helper.Conv.ToDecimal(r2.Read("stock_qty")); item.real_qty = Helper.Conv.ToDecimal(r2.Read("real_qty")); item.balance_qty = Helper.Conv.ToDecimal(r2.Read("balance_qty")); item.memo = r2.Read("memo"); item.other1 = r2.Read("other1"); item.other2 = r2.Read("other2"); item.num1 = Helper.Conv.ToDecimal(r2.Read("num1")); item.num2 = Helper.Conv.ToDecimal(r2.Read("num2")); item.num3 = Helper.Conv.ToDecimal(r2.Read("num3")); item.packqty = Helper.Conv.ToInt(r2.Read("packqty")); item.sgqty = Helper.Conv.ToDecimal(r2.Read("sgqty")); lines.Add(item); } string sheet_no = ""; bll.AddCheckSheet(ord, lines, out sheet_no); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("sheet_no", sheet_no); res = w.ToString(); } else if (t == "change_checksheet") { var ord = new Model.ic_t_check_master(); ord.sheet_no = r.Read("sheet_no"); ord.branch_no = r.Read("branch_no"); ord.oper_id = r.Read("oper_id"); ord.oper_date = Helper.Conv.ToDateTime(r.Read("oper_date")); ord.meno = r.Read("meno"); ord.approve_flag = "0"; ord.cm_branch = r.Read("cm_branch"); ord.deal_man = r.Read("deal_man"); ord.max_change = 0; ord.update_time = Helper.Conv.ToDateTime(r.Read("update_time")); ord.check_no = r.Read("check_no"); List <Model.ic_t_check_detail> lines = new List <Model.ic_t_check_detail>(); foreach (ReadWriteContext.IReadContext r2 in r.ReadList("lines")) { var item = new Model.ic_t_check_detail(); item.sheet_no = r2.Read("sheet_no"); item.item_no = r2.Read("item_no"); item.in_price = Helper.Conv.ToDecimal(r2.Read("in_price")); item.sale_price = Helper.Conv.ToDecimal(r2.Read("sale_price")); item.stock_qty = Helper.Conv.ToDecimal(r2.Read("stock_qty")); item.real_qty = Helper.Conv.ToDecimal(r2.Read("real_qty")); item.balance_qty = Helper.Conv.ToDecimal(r2.Read("balance_qty")); item.memo = r2.Read("memo"); item.other1 = r2.Read("other1"); item.other2 = r2.Read("other2"); item.num1 = Helper.Conv.ToDecimal(r2.Read("num1")); item.num2 = Helper.Conv.ToDecimal(r2.Read("num2")); item.num3 = Helper.Conv.ToDecimal(r2.Read("num3")); item.packqty = Helper.Conv.ToInt(r2.Read("packqty")); item.sgqty = Helper.Conv.ToDecimal(r2.Read("sgqty")); lines.Add(item); } bll.ChangeCheckSheet(ord, lines); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else if (t == "delete_checksheet") { string sheet_no = r.Read("sheet_no"); var update_time = Helper.Conv.ToDateTime(r.Read("update_time")); bll.DeleteCheckSheet(sheet_no, update_time); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else { web.ReflectionMethod(bll, t); res = web.NmJson(); } } catch (Exception ex) { ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "-1"); if (ex.InnerException != null) { w.Append("errMsg", ex.InnerException.Message); LogHelper.writeLog("check()", ex.InnerException.ToString(), t, pars); } else { w.Append("errMsg", ex.Message); LogHelper.writeLog("check()", ex.ToString(), t, pars); } res = w.ToString(); } }
public frmCheckSheet() { InitializeComponent(); // Helper.GlobalData.InitForm(this); // var tb = new DataTable(); tb.Columns.Add("item_no"); tb.Columns.Add("item_subno"); tb.Columns.Add("barcode"); tb.Columns.Add("item_name"); tb.Columns.Add("unit_no"); tb.Columns.Add("item_size"); tb.Columns.Add("item_pack"); tb.Columns.Add("stock_qty", typeof(decimal)); tb.Columns.Add("real_qty", typeof(decimal)); tb.Columns.Add("packqty", typeof(decimal)); tb.Columns.Add("sgqty", typeof(decimal)); tb.Columns.Add("balance_qty", typeof(decimal)); tb.Columns.Add("in_price", typeof(decimal)); tb.Columns.Add("real_amount", typeof(decimal)); tb.Columns.Add("sale_price", typeof(decimal)); editGrid1.AddColumn("item_subno", "货号", "", 100, 1, "", true); editGrid1.AddColumn("barcode", "条码", "", 120, 1, "", true); editGrid1.AddColumn("item_name", "商品名称", "", 150, 1, "", false); editGrid1.AddColumn("unit_no", "单位", "", 60, 2, "", false); editGrid1.AddColumn("item_size", "规格", "", 80, 1, "", false); editGrid1.AddColumn("stock_qty", "系统库存", "", 100, 3, "0.00", false); editGrid1.AddColumn("real_qty", "实际盘点数量", "", 100, 3, "0.00", true); editGrid1.AddColumn("item_pack", "包装数量", "", 100, 3, "0.00", false); editGrid1.AddColumn("packqty", "箱数", "", 100, 3, "0.00", true); editGrid1.AddColumn("sgqty", "零数", "", 100, 3, "0.00", true); editGrid1.AddColumn("balance_qty", "盈亏数量", "", 100, 3, "0.00", false); editGrid1.AddColumn("in_price", "成本价", "", 100, 3, "0.00", false); editGrid1.AddColumn("real_amount", "盈亏金额", "", 100, 3, "0.00", false); editGrid1.SetTotalColumn("balance_qty,real_amount");//合计项 editGrid1.DataSource = tb; // try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // Thread th = new Thread(() => { Helper.GlobalData.windows.ShowLoad(this); try { IBLL.ICommonBLL bll2 = new BLL.CommonBLL(); var branch_tb = bll2.GetBranchList(); this.txtbranch.Invoke((MethodInvoker) delegate { txtbranch.Bind(branch_tb, 300, 200, "branch_no", "branch_no:编号:80,branch_name:名称:140", "branch_no/branch_name->Text"); }); var deal_tb = bll2.GetPeopleList(); this.txt_deal_man.Invoke((MethodInvoker) delegate { txt_deal_man.Bind(deal_tb, 250, 200, "oper_id", "oper_id:编号:80,oper_name:姓名:100", "oper_id/oper_name->Text"); }); IBLL.ICheckBLL bll = new BLL.CheckBLL(); var check_tb = bll.GetCheckInitList(); this.txt_check_no.Invoke((MethodInvoker) delegate { txt_check_no.Bind(check_tb, 250, 200, "sheet_no", "sheet_no:单据号:120,branch_name:机构:120,oper_name:操作员:120,begin_date:起始日期:120", "sheet_no->Text"); }); this.Invoke((MethodInvoker) delegate { IOrder ins = this; ins.Add(); }); } catch (Exception ex) { LogHelper.writeLog("frmCheckSheet", ex.ToString()); MsgForm.ShowFrom(ex); } Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); } catch (Exception ex) { MsgForm.ShowFrom(ex); Helper.LogHelper.writeLog("frmCheckSheet()", ex.ToString()); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }