void IOrder.ShowOrder(string sheet_no) { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // RunType = 2; ic_t_check_init init = bll.GetCheckInitSheet(new ic_t_check_init() { sheet_no = sheet_no, check_status = "0" }); // this.txtStatus.Text = "开始盘点"; this.txtStartTime.Text = init.begin_date.ToString("yyyy-MM-dd HH:mm:ss"); this.txtSheet_no.Text = init.sheet_no; this.txtOper.Text = init.oper_id; this.txtMemo.Text = init.memo; this.txtItemCls.Text = init.item_clsno; this.txtBranch.Text = init.branch_no; // Dictionary <string, object> dic = this.Tag as Dictionary <string, object>; this.Tag = Conv.ControlsAdds(this, dic); } catch (Exception ex) { MsgForm.ShowFrom(ex); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
public void GetCheckInitSheet(WebHelper w, Dictionary <string, object> kv) { ic_t_check_init init = w.GetObject <ic_t_check_init>("init"); DataTable tb = bll.GetCheckInitSheet(init); w.Write(tb); }
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; } }
public void AddChectInitSheet(WebHelper w, Dictionary <string, object> kv) { ic_t_check_init init = w.GetObject <ic_t_check_init>("check_init"); string sheet_no = ""; bll.AddChectInitSheet(init, out sheet_no); w.Write("sheet_no", sheet_no); }
void ICheckBLL.CheckPCSheet(ic_t_check_init ini) { JsonRequest r = new JsonRequest(); r.Write("ini", ini); r.request("/check?t=CheckPCSheet"); if (!r.ReadSuccess()) { throw new Exception(r.ReadMessage()); } }
void ICheckBLL.DeleteChectInitSheet(ic_t_check_init init) { JsonRequest r = new JsonRequest(); r.Write <ic_t_check_init>("init", init); r.request("/check?t=DeleteChectInitSheet"); if (!r.ReadSuccess()) { throw new Exception(r.ReadMessage()); } }
void ICheckBLL.AddChectInitSheet(ic_t_check_init check_init, out string sheet_no) { JsonRequest r = new JsonRequest(); r.Write <ic_t_check_init>("check_init", check_init); r.request("/check?t=AddChectInitSheet"); if (!r.ReadSuccess()) { throw new Exception(r.ReadMessage()); } sheet_no = r.Read("sheet_no"); }
DataTable ICheckBLL.GetCheckInitSheets(ic_t_check_init init) { JsonRequest r = new JsonRequest(); r.Write <ic_t_check_init>("init", init); r.request("/check?t=GetCheckInitSheet"); if (!r.ReadSuccess()) { throw new Exception(r.ReadMessage()); } DataTable tb = r.GetDataTable(); return(tb); }
ic_t_check_init ICheckBLL.GetCheckInitSheet(ic_t_check_init init) { JsonRequest r = new JsonRequest(); r.Write <ic_t_check_init>("init", init); r.request("/check?t=GetCheckInitSheet"); if (!r.ReadSuccess()) { throw new Exception(r.ReadMessage()); } init = r.GetObject <ic_t_check_init>("data"); return(init); }
public System.Data.DataTable GetCheckInitSheet(ic_t_check_init init) { string sql = @"select * , (i.oper_id+'/'+s.oper_name) 操作员, (i.branch_no+'/'+b.branch_name) 仓库, (i.item_clsno+'/'+c.item_clsname) 商品类别, (i.approve_man+'/'+o1.oper_name) 审核人 from ic_t_check_init i left join bi_t_branch_info b on b.branch_no=i.branch_no left join bi_t_item_cls c on c.item_clsno=i.item_clsno left join sa_t_operator_i s on s.oper_id=i.oper_id left join sa_t_operator_i o1 on o1.oper_id=i.approve_man where 1=1 "; if (!string.IsNullOrEmpty(init.sheet_no)) { sql += " and i.sheet_no='" + init.sheet_no + "' "; } if (!string.IsNullOrEmpty(init.branch_no)) { sql += " and i.branch_no='" + init.branch_no + "' "; } if (!string.IsNullOrEmpty(init.check_status)) { sql += " and i.check_status='" + init.check_status + "' "; } if (init.create_time > DateTime.MinValue && init.create_time < DateTime.MaxValue) { sql += " and Convert(varchar(10), i.create_time ,20 ) >= '" + init.create_time.ToString("yyyy-MM-dd") + "' "; } DB.IDB db = new DB.DBByAutoClose(Appsetting.conn); DataTable tb = db.ExecuteToTable(sql, null); return(tb); }
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 void DeleteChectInitSheet(WebHelper w, Dictionary <string, object> kv) { ic_t_check_init init = w.GetObject <ic_t_check_init>("init"); bll.DeleteChectInitSheet(init); }
public void CheckPCSheet(WebHelper w, Dictionary <string, object> kv) { ic_t_check_init init = w.GetObject <ic_t_check_init>("ini"); bll.CheckPCSheet(init); }