public void Del(Model.bi_t_item_info item) { JsonRequest r = new JsonRequest(); r.Write("item_no", item.item_no); r.request("/item?t=delete"); if (!r.ReadSuccess()) { throw new Exception(r.ReadMessage()); } }
public void Update(Model.bi_t_item_info item) { JsonRequest r = new JsonRequest(); r.Write <bi_t_item_info>(item); r.request("/item?t=change"); if (!r.ReadSuccess()) { throw new Exception(r.ReadMessage()); } }
private void insertTHRK(string pay_way, decimal pay_amt) { var gd = new Model.bi_t_item_info(); decimal amt = 0; //单据总金额 IBLL.ICGRK bll = new BLL.CGRK(); var lines_cgrk = new List <Model.ic_t_inout_store_detail>(); int index = 0; foreach (var item in this.lines) { if (goodsDic.TryGetValue(item.item_no, out gd) == false) { new MsgForm("商品读取错误").ShowDialog(); return; } ++index; var line_cgrk = new Model.ic_t_inout_store_detail(); line_cgrk.sheet_no = lblsheet_no.Text.Trim(); line_cgrk.item_no = item.item_no; line_cgrk.item_subno = item.item_subno; line_cgrk.item_name = item.item_name; line_cgrk.unit_no = gd.unit_no; line_cgrk.in_qty = item.qty; line_cgrk.orgi_price = item.source_price; line_cgrk.valid_price = item.price; line_cgrk.cost_price = item.price; line_cgrk.valid_date = DateTime.Now; line_cgrk.barcode = gd.barcode; line_cgrk.sheet_sort = index; line_cgrk.other3 = item.is_give; amt += line_cgrk.valid_price * line_cgrk.in_qty; lines_cgrk.Add(line_cgrk); } var ord = new Model.ic_t_inout_store_master(); ord.sheet_no = lblsheet_no.Text.Trim(); ord.trans_no = "D"; ord.branch_no = Program.branch_no; ord.supcust_no = supcus_no; ord.total_amount = amt; ord.inout_amount = pay_amt; ord.approve_flag = "0"; ord.oper_date = DateTime.Now; ord.oper_id = Program.oper_id; ord.pay_way = pay_way; //新建 bll.InsertOrder(ord, lines_cgrk); }
Model.bi_t_item_info IItem.GetItemBySubno(string item_subno) { string sql = "select * from bi_t_item_info where item_subno='" + item_subno + "'"; DB.IDB db = new DB.DBByAutoClose(Appsetting.conn); var tb = db.ExecuteToTable(sql, null); Model.bi_t_item_info item = null; if (tb.Rows.Count > 0) { item = DB.ReflectionHelper.DataRowToModel <Model.bi_t_item_info>(tb.Rows[0]); } return(item); }
void IBLL.IItem.Change(Model.bi_t_item_info item) { item.update_time = System.DateTime.Now; string sql = "select * from bi_t_item_info where item_subno='" + item.item_subno + "' and item_no<>'" + item.item_no + "'"; DB.IDB db = new DB.DBByAutoClose(Appsetting.conn); var tb = db.ExecuteToTable(sql, null); if (tb.Rows.Count != 0) { throw new Exception("已存在货号" + item.item_subno); } db.Update(item, "item_no"); }
private void panel2_MouseClick(object sender, MouseEventArgs e) { clickPoint = new Point(e.X, e.Y); this.panel2.Refresh(); this.panel2.Refresh(); Model.bi_t_item_info cus = new Model.bi_t_item_info(); if (GetItem(new Point(e.X, e.Y), out cus) == true) { this.item = cus; this.DialogResult = DialogResult.OK; this.Close(); } }
protected override void OnClosed(EventArgs e) { base.OnClosed(e); pageInfo = null; clsList = null; goodsList = null; goodsListAll = null; clsDic = null; goodsDic = null; lines = null; currGoods = null; Program.ReadWeight.WeightMsg -= WeightMsg; }
private bool GetItem(Point p, out Model.bi_t_item_info cus) { foreach (CellInfo cell in pageInfo) { if (cell.rec.Contains(p) == true) { if (cell.item != null) { cus = cell.item; return(true); } } } cus = null; return(false); }
private void newOrder(string text) { if (lines.Count != 0) { var frm = new YesNoForm("新增前是否保存本单据?"); frm.ShowDialog(); if (frm.DialogResult == DialogResult.Yes) { CashPayOrder(); } } supcus_no = ""; lblcussup.Text = ""; lines.Clear(); this.ShowLine(); selectIndex = -1; currGoods = null; panel1.Refresh(); IBLL.ICGRK bll2 = new BLL.CGRK(); lblsheet_no.Text = bll2.GetNewTHOrderCode(); }
public void CheckPCSheet(ic_t_check_init ini) { var db = new DB.DBByHandClose(Appsetting.conn); DB.IDB d = db; try { db.Open(); db.BeginTran(); // ic_t_check_init master = d.ExecuteToModel <ic_t_check_init>("select * from ic_t_check_init where sheet_no='" + ini.sheet_no + "'", null); if (master == null || string.IsNullOrEmpty(master.sheet_no)) { throw new Exception("单据:[" + ini.sheet_no + "]不存在"); } if (!master.approve_flag.Equals("0")) { throw new Exception("单据:[" + ini.sheet_no + "]已审核"); } master.sheet_no = ini.sheet_no; master.approve_flag = "1"; master.approve_date = ini.approve_date; master.approve_man = ini.approve_man; master.update_time = DateTime.Now; master.check_status = "2"; master.memo = ini.memo; master.end_date = DateTime.Now; d.Update(master, "sheet_no"); // DataTable tb = d.ExecuteToTable("select * from ic_t_check_finish where sheet_no='" + ini.sheet_no + "'", null); foreach (DataRow dr in tb.Rows) { if ("1".Equals(dr["change_flag"].ToString())) { //修改库存 //写入库存流水、结存 string sql = "select * from ic_t_branch_stock where branch_no='" + master.branch_no + "'" + " and item_no='" + dr["item_no"] + "' "; Model.ic_t_branch_stock stock = d.ExecuteToModel <Model.ic_t_branch_stock>(sql, null); if (stock == null) { continue; } // sql = "select * from bi_t_item_info where item_no='" + dr["item_no"] + "'"; Model.bi_t_item_info it = d.ExecuteToModel <Model.bi_t_item_info>(sql, null); if (it == null) { throw new Exception("不存在商品内码" + dr["item_no"]); } // sql = "select isnull(max(flow_id)+1,1) from ic_t_flow_dt"; Model.ic_t_flow_dt flow = new Model.ic_t_flow_dt(); flow.flow_id = Helper.Conv.ToInt64(d.ExecuteScalar(sql, null)); flow.branch_no = master.branch_no; flow.item_no = dr["item_no"].ToString(); flow.oper_date = System.DateTime.Now; flow.init_qty = stock.stock_qty; flow.init_amt = stock.stock_qty * stock.cost_price; flow.new_qty = Conv.ToDecimal(dr["real_qty"]) - Conv.ToDecimal(dr["stock_qty"]); flow.new_amt = flow.new_qty * Conv.ToDecimal(dr["in_price"]); flow.settle_qty = flow.init_qty + flow.new_qty; flow.settle_amt = flow.init_amt + flow.new_qty * Conv.ToDecimal(dr["sale_price"]); flow.cost_price = Conv.ToDecimal(dr["sale_price"]); flow.db_type = Conv.ToDecimal(dr["real_qty"]) > Conv.ToDecimal(dr["stock_qty"]) ? "+" : "-"; flow.sheet_no = dr["sheet_no"].ToString(); flow.sheet_type = "PC"; flow.voucher_no = dr["sheet_no"].ToString(); flow.supcust_no = ""; flow.supcust_flag = ""; flow.oper_day = System.DateTime.Now.ToString("yyyy/MM/dd"); flow.adjust_amt = flow.settle_amt; flow.cost_type = it.cost_type; flow.sale_price = Conv.ToDecimal(dr["sale_price"]); d.Insert(flow); // if (flow.new_qty != 0) { Model.ic_t_cost_adjust ad = new Model.ic_t_cost_adjust(); sql = "select isnull(max(flow_id)+1,1) from ic_t_cost_adjust"; ad.flow_id = Helper.Conv.ToInt64(d.ExecuteScalar(sql, null)); ad.branch_no = dr["branch_no"].ToString(); ad.item_no = dr["item_no"].ToString(); ad.oper_date = System.DateTime.Now; ad.old_price = stock.cost_price; ad.new_price = flow.cost_price; ad.in_qty = flow.new_qty; ad.sheet_no = dr["sheet_no"].ToString(); ad.memo = ""; ad.type_no = "1"; ad.adjust_amt = flow.new_qty; ad.sup_no = ""; ad.max_flow_id = flow.flow_id; ad.cost_type = it.cost_type; ad.old_qty = stock.stock_qty; d.Insert(ad); } // stock.stock_qty = flow.settle_qty; stock.cost_price = flow.cost_price; stock.last_price = Conv.ToDecimal(dr["in_price"]); d.Update(stock, "branch_no,item_no", "stock_qty,cost_price,last_price"); } } // db.CommitTran(); } catch (Exception ex) { Log.writeLog("CheckBLL.CheckPCSheet()", ex.ToString(), ini.sheet_no); db.RollBackTran(); throw ex; } finally { db.Close(); } }
public CellInfo(Rectangle rec, Model.bi_t_item_info item) { this.rec = rec; this.item = item; }
//取重、输入数量 private void inputQty(string text) { if (supcus_no == "") { new MsgForm("未选择客户").ShowDialog(); return; } if (currGoods != null) { if (Program.is_continue_weight == "1" && total_weight == Weight) { new MsgForm("请先放商品,再取重").ShowDialog(); return; } IBLL.ISaleData bll = new BLL.SaleData(); IBLL.IGoods goodsBLL = new BLL.Goods(); Model.bi_t_item_info gd = currGoods; Model.t_order_detail item = new Model.t_order_detail(); item.item_no = gd.item_no; switch (text) { case "取重": if (Program.is_continue_weight == "1" && total_weight != 0) { item.qty = Weight - total_weight; } else { item.qty = Weight; } break; case "手输数量": if (Program.can_input_qty == "1" && currGoods.item_flag == "1") { new MsgForm("称重商品不可手输数量").ShowDialog(); return; } InputNumerForm frm = new InputNumerForm("数量", 3); decimal qty = 0; if (frm.Input(out qty) == true) { if (qty <= 0) { new MsgForm("数量不正确").ShowDialog(); return; } item.qty = qty; } else { return; } break; } if (bll.CheckCusIsRetail(supcus_no)) { item.price = currGoods.base_price;//一级批发价 } else { IBLL.IClientBLL bll2 = new BLL.ClientBLL(); item.price = bll2.GetCusItemPrice(supcus_no, item.item_no); //在线取客户零批价 } total_weight = Weight; item.item_subno = gd.item_subno; item.item_name = gd.item_name; item.unit_no = gd.unit_no; item.amt = item.qty * item.price; item.sheet_no = lblsheet_no.Text; item.oper_id = Program.oper_id; item.oper_date = DateTime.Now; item.jh = Program.jh; item.cost_price = goodsBLL.GetCost(gd.item_no, Program.branch_no); item.branch_no = Program.branch_no; item.cus_no = supcus_no; item.sup_no = supcus_no; item.is_give = "0"; item.source_price = item.price; item.discount = 1; int flow_id = 0; bll.Insert(item, out flow_id); item.flow_id = flow_id; this.lines.Add(item); this.ShowLine(); } }
private void ShowGoods(List <Model.bi_t_item_info> lst, Control par, ref int pageIndex, Graphics g) { int w = 100; int h = 70; int w_offset = 0; int h_offset = 0; int min_offset = 9999; for (int i = 0; i < 20; i++) { int val = w + i; int mod = par.Width % val; if (min_offset > mod) { min_offset = mod; w_offset = i; } } min_offset = 9999; for (int i = 0; i < 20; i++) { int val = h + i; int mod = par.Height % val; if (min_offset > mod) { min_offset = mod; h_offset = i; } } w += w_offset - 1; h += h_offset - 1; int colNum = par.Width / w; int rowNum = par.Height / h; int pageSize = rowNum * colNum; pageSize -= colNum; // int index = pageIndex * pageSize; if (index > lst.Count - 1) { pageIndex--; index = pageIndex * pageSize; } SolidBrush bru = new SolidBrush(Color.WhiteSmoke); Pen p = new Pen(Color.Gray); for (int i = 0; i < rowNum; i++) { for (int j = 0; j < colNum; j++) { if (i == 0 && j == 0) { Rectangle rec = new Rectangle(j * w, i * h, w, h); lblUp.Location = new Point(rec.Left + 1, rec.Top + 1); lblUp.Size = new Size(rec.Width - 1, rec.Height - 1); g.DrawRectangle(p, rec); } else if (i == 0 && j == colNum - 1) { Rectangle rec = new Rectangle(j * w, i * h, w, h); lblDown.Location = new Point(rec.Left + 1, rec.Top + 1); lblDown.Size = new Size(rec.Width - 1, rec.Height - 1); g.DrawRectangle(p, rec); } else if (i == 0) { } else if (index > lst.Count - 1) { Rectangle rec = new Rectangle(j * w, i * h, w, h); g.FillRectangle(bru, rec); g.DrawRectangle(p, rec); clickPoint = new Point(-100, -100); index++; } else { Rectangle rec = new Rectangle(j * w, i * h, w, h); Color ForeColor = Color.Black; if (rec.Contains(clickPoint) == true && index >= 0) { selectIndex = index; currGoods = lst[selectIndex]; g.FillRectangle(Brushes.Blue, rec); clickPoint = new Point(-100, -100); ForeColor = Color.White; ShowSelectedGoods(); } else if (selectIndex == index) { g.FillRectangle(Brushes.Blue, rec); ForeColor = Color.White; } else { g.FillRectangle(bru, rec); ForeColor = Color.Black; } g.DrawRectangle(p, rec); if (lst.Count > index && index >= 0) { var item = lst[index]; StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; Rectangle rec1 = new Rectangle(rec.Left, rec.Top, rec.Width, 40); //g.DrawString(item.item_subno, new Font("SimSun", 12), new SolidBrush(ForeColor), rec1, sf); Rectangle rec2 = new Rectangle(rec.Left, rec.Top + 20, rec.Width, 30); string item_name = ""; string item_size = ""; if (item != null && item.item_name != null && item.item_name.Length > 0) { item_size = item.item_size; int flag = 0; for (int k = 1; k <= item.item_name.Length; k++) { item_name = item.item_name.Substring(0, k); var s1 = g.MeasureString(item_name, new Font("SimSun", 12)); if (s1.Width > rec.Width) { item_name = item.item_name.Substring(0, k - 1); flag = 1; break; } } if (flag == 0) { item_name = item.item_name; } } g.DrawString(item_name, new Font("SimSun", 12), new SolidBrush(ForeColor), rec2, sf); //Rectangle rec3 = new Rectangle(rec.Left, rec.Top + 40, rec.Width, 30); //g.DrawString(item_size, new Font("SimSun", 12), new SolidBrush(ForeColor), rec3, sf); index++; } } } if (i == 0) { Rectangle rec = new Rectangle(1 * w, i * h, (colNum - 2) * w, h); lblWeight.Location = new Point(rec.Left + 1, rec.Top + 1); lblWeight.Size = new Size(rec.Width - 1, rec.Height - 1); g.DrawRectangle(p, rec); } } }