private void ShowData() { CAI_OrderChecksService checksSer = new CAI_OrderChecksService(); List <CAI_OrderChecks> allChecks = checksSer.GetListArrayPOOrderChecks_Cai_POOrderInHouse_ListView(string.Format(" 1=1 and ProNo='{0}' and PONo='{1}' and SupplierName='{2}'", txtChcekProNo.Text, txtPONo.Text, txtSupplier.Text)); List <CAI_OrderInHouses> POOrders = new List <CAI_OrderInHouses>();// Session["Orders"] as List<CAI_OrderInHouses>; foreach (var model in allChecks) { CAI_OrderInHouses houseModel = new CAI_OrderInHouses(); houseModel.Good_Model = model.Good_Model; houseModel.GoodName = model.GoodName; houseModel.GoodNo = model.GoodNo; houseModel.GoodNum = model.CheckNum; houseModel.GoodPrice = model.CheckPrice; houseModel.GoodSpec = model.GoodSpec; houseModel.GoodTypeSmName = model.GoodTypeSmName; houseModel.GoodUnit = model.GoodUnit; houseModel.GooId = model.CheckGoodId; houseModel.Total = model.Total; houseModel.OrderCheckIds = model.Ids; houseModel.QingGouPer = model.QingGou; POOrders.Add(houseModel); } Session["Orders"] = POOrders; gvList.DataSource = POOrders; gvList.DataBind(); }
private void LastUpdate(int id) { CAI_OrderInHousesService ordersSer = new CAI_OrderInHousesService(); List <CAI_OrderInHouses> orders = ordersSer.GetListArray(" 1=1 and CAI_OrderInHouses.id=1"); CAI_OrderChecksService ordersSer111 = new CAI_OrderChecksService(); List <CAI_OrderChecks> orders1111 = ordersSer111.GetListArray(" 1=1 and CAI_OrderChecks.CheckId=" + id); CAI_OrderCheckService mainSer = new CAI_OrderCheckService(); CAI_OrderCheck pp = mainSer.GetModel(id); DBHelp.ExeCommand(string.Format(@" update CAI_OrderInHouse SET ChcEkProNo='{0}',pono='{1}',poname='{2}' where id=1; update CAI_OrderOutHouse set pono='{1}',poname='{2}' where ChcEkProNo='20120000'; update CAI_OrderCheck set status='通过' where id={3} ;update tb_EForm set state='通过',e_LastTime=getdate() where allE_id={3} and proId=21;", pp.ProNo, orders1111[0].PONo, orders1111[0].POName, id)); using (SqlConnection conn = DBHelp.getConn()) { conn.Open(); SqlTransaction tan = conn.BeginTransaction(); SqlCommand objCommand = conn.CreateCommand(); objCommand.Transaction = tan; CAI_POCaiService CaiSer = new CAI_POCaiService(); try { objCommand.Parameters.Clear(); foreach (var caiIn in orders) { var check = orders1111.Single(t => t.CheckGoodId == caiIn.GooId); string sql = string.Format(" update CAI_OrderInHouses set OrderCheckIds={1} where ids={0}", caiIn.Ids, check.Ids); objCommand.CommandText = sql; objCommand.ExecuteNonQuery(); } tan.Commit(); } catch (Exception) { tan.Rollback(); } } }
public bool FormCheck() { #region 设置自己要判断的信息 if (txtRuTime.Text == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写入库日期!');</script>"); txtRuTime.Focus(); return(false); } else { if (CommHelp.VerifesToDateTime(txtRuTime.Text) == false) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('入库日期 格式错误!');</script>"); return(false); } } if (txtChcekProNo.Text == "") { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写检验单号!');</script>"); txtChcekProNo.Focus(); return(false); } try { Convert.ToDateTime(txtRuTime.Text); } catch (Exception) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写检验时间有误!');</script>"); txtRuTime.Focus(); return(false); } if (ddlPers.Visible == true && ddlPers.SelectedItem == null) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请选择下一步审核人!');</script>"); ddlPers.Focus(); return(false); } if (DBHelp.ExeScalar(string.Format("select ID from tb_User where loginName='{0}'", txtName.Text)) == null) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写申请用户不存在!');</script>"); return(false); } #endregion if (Request["allE_id"] == null) { List <CAI_OrderInHouses> POOrders = Session["Orders"] as List <CAI_OrderInHouses>; if (POOrders == null || POOrders.Count <= 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('请添加明显信息!');</script>"); return(false); } Hashtable ht = new Hashtable(); foreach (var model in POOrders) { if (!ht.Contains(model.OrderCheckIds)) { ht.Add(model.OrderCheckIds, null); } else { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format(@"<script>alert('商品[{0}]\规格[{1}]\型号[{2}],信息重复!');</script>", model.GoodName, model.GoodSpec, model.Good_Model)); return(false); } if (model.GoodNum <= 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format(@"<script>alert('商品[{0}]\规格[{1}]\型号[{2}],数量必须大于0!');</script>", model.GoodName, model.GoodSpec, model.Good_Model)); return(false); } if (model.GoodPrice < 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format(@"<script>alert('商品[{0}]\规格[{1}]\型号[{2}],价格必须大于等于0!');</script>", model.GoodName, model.GoodSpec, model.Good_Model)); return(false); } } int i = 0; CAI_OrderChecksService checksSer = new CAI_OrderChecksService(); foreach (var model in POOrders) { TextBox txtNum = gvList.Rows[i].FindControl("txtNum") as TextBox; if (txtNum != null) { model.GoodNum = Convert.ToDecimal(txtNum.Text); } TextBox txtGoodRemark = gvList.Rows[i].FindControl("txtGoodRemark") as TextBox; if (txtGoodRemark != null) { model.GoodRemark = txtGoodRemark.Text; } //List<CAI_OrderChecks> allChecks = checksSer.GetListArrayPOOrderChecks_Cai_POOrderInHouse_ListView(string.Format(" 1=1 and ProNo='{0}' and PONo='{1}' and ids={2} and SupplierName='{3}'", txtChcekProNo.Text, txtPONo.Text, model.OrderCheckIds,txtSupplier.Text)); List <CAI_OrderChecks> allChecks = checksSer.GetListArrayPOOrderChecks_Cai_POOrderInHouse_ListView(" ids=" + model.OrderCheckIds); //List<Model.JXC.CG_POOrders> POOrdersList = poOrderSer.GetListCG_POOrders_Cai_POOrders_View(string.Format(" 1=1 and CG_POOrders_Cai_POOrders_View.id in (select id from CG_POOrder where PONo='{0}') and ids={1}", txtPONo.Text, model.CG_POOrdersId)); if (allChecks.Count <= 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format(@"<script>alert('商品[{0}]\规格[{1}]\型号[{2}],在订单[{3}]中不存在!');</script>", model.GoodName, model.GoodSpec, model.Good_Model, txtPONo.Text)); return(false); } if (model.GoodNum > allChecks[0].CheckNum) { base.ClientScript.RegisterStartupScript(base.GetType(), null, string.Format(@"<script>alert('商品[{0}]\规格[{1}]\型号[{2}],数量剩余[{3}]!');</script>", model.GoodName, model.GoodSpec, model.Good_Model, allChecks[0].CheckNum)); return(false); } i++; } Session["Orders"] = POOrders; } return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { if (Session["LoginName"].ToString() != "admin") { Button1.Visible = false; } //请假单子 Session["Orders"] = null; lbtnAddFiles.Visible = false; gvList.Columns[0].Visible = false; gvList.Columns[12].Visible = false; //gvList.Columns[1].Visible = false; if (base.Request["ProId"] != null) { //加载基本数据 VAN_OA.Model.User use = Session["userInfo"] as VAN_OA.Model.User; txtName.Text = use.LoginName; txtCheckTime.Text = DateTime.Now.ToString(); tb_EFormService eformSer = new tb_EFormService(); if (Request["allE_id"] == null)//单据增加 { //权限1(销售) lbtnAddFiles.Visible = true; gvList.Columns[0].Visible = true; // gvList.Columns[1].Visible = true; gvList.Columns[12].Visible = true; gvList.Columns[13].Visible = false; //加载初始数据 List <CAI_OrderChecks> orders = new List <CAI_OrderChecks>(); Session["Orders"] = orders; ViewState["OrdersCount"] = orders.Count; gvList.DataSource = orders; gvList.DataBind(); //检查自己是否在请假单中流程设置中,来确定自己下一个审批人 lblResult.Visible = false; lblYiJian.Visible = false; ddlResult.Visible = false; txtResultRemark.Visible = false; if (eformSer.ifHasNodes(Convert.ToInt32(Request["ProId"]))) { //获取审批人 int pro_IDs = 0; int ids = 0; List <A_Role_User> roleUserList = eformSer.getFristNodeUsers(Convert.ToInt32(Session["currentUserId"].ToString()), Convert.ToInt32(Request["ProId"]), out ids); ViewState["ids"] = ids; if (roleUserList != null) { ddlPers.DataSource = roleUserList; ddlPers.DataBind(); ddlPers.DataTextField = "UserName"; ddlPers.DataValueField = "UserId"; } else { lblPer.Visible = false; ddlPers.Visible = false; } } else { lblPer.Visible = false; ddlPers.Visible = false; } } else//单据审批 { ViewState["POOrdersIds"] = ""; //加载已经审批的数据 tb_EFormsService eformsSer = new tb_EFormsService(); List <VAN_OA.Model.EFrom.tb_EForms> eforms = eformsSer.GetListArray(string.Format(" e_Id in (select id from tb_EForm where proId={0} and allE_id={1})", Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]))); if (eforms.Count > 0) { string mess = @"<table cellpadding='0' cellspacing='0' width='100%' bordercolorlight='#999999' bordercolordark='#FFFFFF' border='1' ><tr><td colspan='6' style=' height:20px; background-color:#336699; color:White;'>流程图</td></tr>"; for (int i = 0; i < eforms.Count; i++) { string per = ""; if (eforms[i].consignor != null && eforms[i].consignor != 0) { per = eforms[i].Consignor_Name + "(委托人:" + eforms[i].Audper_Name + ")"; } else { per = eforms[i].Audper_Name; } mess += string.Format("<tr><td align='center'>第{0}步</td><td>序号{0}:{1}</td><td><span style='color:red;'>{2}</span>[<span style='color:blue;'>{3} {4}</span>]<br/>意见:{5}</td></tr>", i + 1, eforms[i].RoleName , per, eforms[i].resultState, eforms[i].doTime, eforms[i].idea); } mess += "</table>"; lblMess.Text = mess; } ViewState["EformsCount"] = eforms.Count; #region 加载 请假单数据 CAI_OrderCheckService mainSer = new CAI_OrderCheckService(); CAI_OrderCheck pp = mainSer.GetModel(Convert.ToInt32(Request["allE_id"])); txtName.Text = pp.CreateName; txtCheckPer.Text = pp.CheckUserName; txtCheckTime.Text = pp.CheckTime.ToString(); txtCheckRemark.Text = pp.CheckRemark; if (pp.ProNo != null) { lblProNo.Text = pp.ProNo; } CAI_OrderChecksService ordersSer = new CAI_OrderChecksService(); List <CAI_OrderChecks> orders = ordersSer.GetListArray(" 1=1 and CAI_OrderChecks.CheckId=" + Request["allE_id"]); Session["Orders"] = orders; ViewState["OrdersCount"] = orders.Count; gvList.DataSource = orders; gvList.DataBind(); #endregion //判断单据是否已经结束 if (eformSer.ifFinish(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]))) { btnSub.Visible = false; lblPer.Visible = false; ddlPers.Visible = false; lblResult.Visible = false; lblYiJian.Visible = false; ddlResult.Visible = false; txtResultRemark.Visible = false; setEnable(false); } else { //是否为审核人 if (eformSer.ifAudiPer(Convert.ToInt32(Session["currentUserId"]), Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]))) { if (eformSer.ifLastNode(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]))) { lblPer.Visible = false; ddlPers.Visible = false; } else { int ids = 0; List <A_Role_User> roleUserList = eformSer.getUserToAdu(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]), out ids); ViewState["ids"] = ids; if (roleUserList != null) { ddlPers.DataSource = roleUserList; ddlPers.DataBind(); ddlPers.DataTextField = "UserName"; ddlPers.DataValueField = "UserId"; } } setEnable(eformSer.ifEdit(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]))); gvList.Columns[12].Visible = true; } else { //是否为代理人 if (eformSer.ifAudiPerByUserName(Convert.ToInt32(Session["currentUserId"]), Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]))) { ViewState["ifConsignor"] = true; if (eformSer.ifLastNode(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]))) { lblPer.Visible = false; ddlPers.Visible = false; } else { int ids = 0; List <A_Role_User> roleUserList = eformSer.getUserToAdu(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]), out ids); ViewState["ids"] = ids; if (roleUserList != null) { ddlPers.DataSource = roleUserList; ddlPers.DataBind(); ddlPers.DataTextField = "UserName"; ddlPers.DataValueField = "UserId"; } } setEnable(eformSer.ifEdit(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]))); gvList.Columns[12].Visible = true; } else { btnSub.Visible = false; lblPer.Visible = false; ddlPers.Visible = false; lblResult.Visible = false; lblYiJian.Visible = false; ddlResult.Visible = false; txtResultRemark.Visible = false; setEnable(false); } } } } } } }