/// <summary> /// 作废按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void BtnPur00_Cancel(Object sender, EventArgs e) { string Pur00_ID = tbxPurchase_ID.Text.ToString(); var model = Purchase00.SingleOrDefault(x => x.Purchase_ID == Pur00_ID); if (model == null) { FineUI.Alert.ShowInParent("订单单号不存在", FineUI.MessageBoxIcon.Information); } //1 = 存档 2 = 核准 3 = 作废 4 = 已引入(供应商进货) switch (model.STATUS) { case 1: model.STATUS = 3; break; case 2: FineUI.Alert.ShowInParent("订单已核准,无法进行作废", FineUI.MessageBoxIcon.Information); return; case 3: model.STATUS = 1; break; case 4: FineUI.Alert.ShowInParent("订单已引入,无法进行作废", FineUI.MessageBoxIcon.Information); return; default: FineUI.Alert.ShowInParent("订单状态有误,无法进行作废", FineUI.MessageBoxIcon.Information); return; } ddlStatus.SelectedValue = model.STATUS.ToString(); var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString()); model.MOD_DATETIME = DateTime.Now; model.LAST_UPDATE = DateTime.Now; model.MOD_USER_ID = OlUser.Manager_LoginName; string result = ""; try { Purchase00Bll.GetInstence().Save(this, model); } catch (Exception err) { result = err.Message; } //BtnPur01_Edit(sender, e); //string result = Pur01_Edit(); if (String.IsNullOrEmpty(result)) { result = Pur_Edit(); } LoadPur(); LoadDataPur01(); FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Error); //FineUI.Alert.ShowInParent("核准成功", FineUI.MessageBoxIcon.Information); }
/// <summary> /// 采购主表更新 /// </summary> /// <returns></returns> public string Pur01_Edit() { #region 校验数据 string _SHOP_ID = ddlSHOP_NAME.SelectedValue; if (String.IsNullOrEmpty(_SHOP_ID)) { //FineUI.Alert.ShowInParent("分店编码不允许为空", FineUI.MessageBoxIcon.Error); return("分店编码不允许为空"); } //string _EXPECT_DATE = dpAPP_DATETIME.SelectedDate.ToString(); //if (dpAPP_DATETIME.SelectedDate < DateTime.Now) //{ // //FineUI.Alert.ShowInParent("期望日期不能小于当前时间", FineUI.MessageBoxIcon.Error); // return "期望日期不能小于当前时间"; //} string _SUP_ID = ddlSHOP_NAME.SelectedValue; if (String.IsNullOrEmpty(_SUP_ID)) { //FineUI.Alert.ShowInParent("厂商不能为空", FineUI.MessageBoxIcon.Error); return("厂商不能为空"); } #endregion string _Pur00_id = tbxPurchase_ID.Text; var model = Purchase00.SingleOrDefault(x => x.Purchase_ID == _Pur00_id); if (model == null) { //FineUI.Alert.ShowInParent("采购单号已存在不允许添加", FineUI.MessageBoxIcon.Error); return("该订单不存在"); } else { try { var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString()); //model = new Purchase00(); model.SHOP_ID = _SHOP_ID; model.STATUS = 1; model.INPUT_DATE = DateTime.Now; model.EXPECT_DATE = ConvertHelper.StringToDatetime(dpEXPECT_DATE.SelectedDate.ToString()); model.SUP_ID = ddlSUP_NAME.SelectedValue.ToString(); model.PAY_STATUS = ConvertHelper.Cint(ddlPAY_STATUS.SelectedValue); model.USER_ID = OlUser.Manager_LoginName; model.APP_USER = ""; model.APP_DATETIME = ConvertHelper.StringToDatetime("1900-01-01 00:00:00"); model.TOT_AMOUNT = 0; model.TOT_TAX = ConvertHelper.StringToDecimal(numTOT_QTY.Text); model.TOT_QTY = 0; model.PRE_PAY = 0; model.PRE_PAY_ID = ""; model.EXPORTED = 0; model.EXPORTED_ID = ""; model.LOCKED = 0; model.CRT_DATETIME = ConvertHelper.StringToDatetime(DateTime.Now.ToLongDateString()); model.CRT_USER_ID = OlUser.Manager_LoginName; model.MOD_DATETIME = ConvertHelper.StringToDatetime(DateTime.Now.ToLongDateString()); model.MOD_USER_ID = OlUser.Manager_LoginName; model.LAST_UPDATE = ConvertHelper.StringToDatetime(DateTime.Now.ToLongDateString()); model.SetIsNew(false); Purchase00Bll.GetInstence().Save(this, model); LoackPur01(); //FineUI.Alert.ShowInParent("保存成功", FineUI.MessageBoxIcon.Error); return(""); } catch (Exception err) { return(err.Message); } } }
/// <summary> /// 核准按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void BtnPur00_Approval(Object sender, EventArgs e) { string Pur00_ID = tbxPurchase_ID.Text.ToString(); var model = Purchase00.SingleOrDefault(x => x.Purchase_ID == Pur00_ID); if (model == null) { FineUI.Alert.ShowInParent("订单单号不存在", FineUI.MessageBoxIcon.Information); return; } if (model.STATUS == 1) { DataTable dsCom = (DataTable)SPs.Get_MAX_Inventory_DATE().ExecuteDataTable(); DateTime dtInput = DateTime.Parse(dsCom.Rows[0]["INPUT_DATE"].ToString()); if (model.INPUT_DATE.CompareTo(dtInput) <= 0) { FineUI.Alert.ShowInParent("单据小于盘点日期,不允许盘点。盘点日期为:" + dsCom.Rows[0]["INPUT_DATE"].ToString() + "", FineUI.MessageBoxIcon.Information); return; } } //1 = 存档 2 = 核准 3 = 作废 4 = 已引入(供应商进货) switch (model.STATUS) { case 1: model.STATUS = 2; break; case 2: model.STATUS = 1; break; case 3: FineUI.Alert.ShowInParent("订单已作废,无法进行核准", FineUI.MessageBoxIcon.Information); return; case 4: FineUI.Alert.ShowInParent("订单已引入,无法进行核准", FineUI.MessageBoxIcon.Information); return; default: FineUI.Alert.ShowInParent("订单状态有误,无法核准", FineUI.MessageBoxIcon.Information); return; } ddlStatus.SelectedValue = model.STATUS.ToString(); var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString()); model.MOD_DATETIME = DateTime.Now; model.LAST_UPDATE = DateTime.Now; model.MOD_USER_ID = OlUser.Manager_LoginName; model.APP_DATETIME = DateTime.Now; string result = ""; try { Purchase00Bll.GetInstence().Save(this, model); } catch (Exception err) { result = err.Message; } //BtnPur01_Edit(sender, e); //string result = Pur01_Edit(); if (String.IsNullOrEmpty(result)) { result = Pur_Edit(); } LoadMain(); LoadDetail(); if (result == "保存成功") { string alterMssage = ButtonCheck.Text; if (alterMssage == "反核准") { FineUI.Alert.ShowInParent("核准成功", FineUI.MessageBoxIcon.Error); } else { FineUI.Alert.ShowInParent("取消核准成功", FineUI.MessageBoxIcon.Error); } } else { FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Error); } //FineUI.Alert.ShowInParent("核准成功", FineUI.MessageBoxIcon.Information); }