protected void btnDelete_Click(object sender, EventArgs e) { int[] rows = GridSupplier.SelectedRowIndexArray; if (rows.Length > 0) { string code = ""; foreach (int index in rows) { code += PubFunc.GridDataGet(GridSupplier, index)["CODE"].ToString() + ","; } code = code.TrimEnd(',').Replace(",", "','"); //DataTable DT = DbHelperOra.Query("select licensetype from sup_license_sup where licensetype in(select code from doc_license where code in ('" + code + "')) ").Tables[0]; //DataTable DT1 = DbHelperOra.Query("select licensetype from SUP_LICENSE_GOODS where licensetype in (select code from doc_license where code in ('" + code + "'))").Tables[0]; //if (DT.Rows.Count > 0 || DT1.Rows.Count > 0) //{ // Alert.Show("该证照类别正在使用无法删除!", "提示", MessageBoxIcon.Information); // return; //} DbHelperOra.ExecuteSql("DELETE FROM DOC_LICENSE WHERE CODE IN ('" + code + "')"); Alert.Show("证照类别【" + code + "】删除成功!"); dataSearch(); } else { Alert.Show("请选择要删除的证照类别!"); } }
protected void btnExport_Click(object sender, EventArgs e) { String sql = @"SELECT DBC.USERS USERID,OU.USERNAME,DBC.ISSEND,DECODE(DBC.ISSEND,'N','未发送','Y','已发送','E','异常')ISSENDNAME,DBC.BRCONTENT,DBC.TIMEUP FROM DOC_BRIEF_CON DBC,SYS_OPERUSER OU WHERE DBC.USERS=OU.USERID "; int total = 0; string strwhere = ""; PubFunc.FormDataCheck(FormSearch); if (!string.IsNullOrEmpty(ddlUSERS.SelectedValue)) { strwhere += string.Format(" AND OU.USERID LIKE'%{0}%' ", ddlUSERS.SelectedValue); } if (!string.IsNullOrEmpty(ddlISSEND.SelectedValue)) { strwhere += string.Format(" AND DBC.ISSEND='{0}' ", ddlISSEND.SelectedValue); } if (dpkBegRQ.SelectedDate != null && dpkEndRQ.SelectedDate != null) { strwhere += string.Format(" AND TRUNC(DBC.TIMEUP,'DD') BETWEEN TRUNC(TO_DATE('{0}','YYYY-MM-DD HH24:MI:SS'),'DD') AND TRUNC(TO_DATE('{1}','YYYY-MM-DD HH24:MI:SS'),'DD') ", dpkBegRQ.SelectedDate, dpkEndRQ.SelectedDate); } sql += strwhere; DataTable dtData = DbHelperOra.Query(sql).Tables[0]; if (dtData == null || dtData.Rows.Count == 0) { Alert.Show("无法导出!", "消息提示", MessageBoxIcon.Warning); return; } DataTable dt = PubFunc.GridDataGet(GridToBrief); string[,] colName = { { "USERID", "USERNAME", "ISSENDNAME", "TIMEUP", "BRCONTENT" }, { "用户编码", "用户名称", "状态", "更新时间", "发送内容" } }; ExcelHelper.ExportByWeb(dt, "简报发送信息导出", "简报发送信息导出_" + DateTime.Now.ToString("yyyyMMddHH") + ".xls", colName); }
protected void btnCondSave_Click(object sender, EventArgs e) { DataTable dt = PubFunc.GridDataGet(GridPerson); //DataTable dt = new DataTable(); //dt.Columns.Add(new DataColumn("USERID", typeof(string))); //dt.Columns.Add(new DataColumn("USERNAME", typeof(string))); //dt.Columns.Add(new DataColumn("FLAGNAME", typeof(string))); //dt.Columns.Add(new DataColumn("FLAG", typeof(string))); string strVal = string.Empty; foreach (CheckItem item in chkPersons.SelectedItemArray) { strVal += item.Value + ","; DataRow[] rows = dt.Select("USERID='" + item.Value + "'"); if (rows.Length <= 0) { DataRow dr = dt.NewRow(); dr["USERID"] = item.Value; dr["USERNAME"] = item.Text; dr["FLAGNAME"] = "新备忘"; dr["FLAG"] = "N"; dr["LRRQ"] = ""; dr["LOOKRQ"] = ""; dt.Rows.Add(dr); } } GridPerson.DataSource = dt; GridPerson.DataBind(); hfdLOOKPER.Text = strVal.TrimEnd(','); winPerson.Hidden = true; chkPersons.SelectedValueArray = new string[] { }; }
protected void btnAudit_Click(object sender, EventArgs e) { if (ddlDEPTOUT.SelectedValue.Length < 1) { Alert.Show("请选择【出库部门】!"); return; } if (GridList.SelectedRowIndexArray.Length <= 0) { return; } DataTable table = PubFunc.GridDataGet(GridList); string billno = DbHelperOra.GetSingle("SELECT SEQ_PUBLIC.NEXTVAL FROM DUAL").ToString(); List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtCom = new MyTable("DAT_DSCK_LIST"); foreach (int index in GridList.SelectedRowIndexArray) { mtCom.ColRow["SEQNO"] = billno; mtCom.ColRow["ROWNO"] = index + 1; mtCom.ColRow["DEPTOUT"] = ddlDEPTOUT.SelectedValue; mtCom.ColRow["DEPTIN"] = table.Rows[index]["DEPTID"].ToString(); mtCom.ColRow["GDSEQ"] = table.Rows[index]["GDSEQ"].ToString(); mtCom.ColRow["GDNAME"] = table.Rows[index]["GDNAME"].ToString(); mtCom.ColRow["UNIT"] = table.Rows[index]["UNIT"].ToString(); mtCom.ColRow["GDSPEC"] = table.Rows[index]["GDSPEC"].ToString(); mtCom.ColRow["PRODUCER"] = table.Rows[index]["PRODUCER"].ToString(); mtCom.ColRow["DSSL"] = table.Rows[index]["DSNUM"].ToString(); mtCom.ColRow["DSHL"] = table.Rows[index]["NUM1"].ToString(); mtCom.ColRow["DSKC"] = table.Rows[index]["KCSL"].ToString(); mtCom.ColRow["DSDC"] = table.Rows[index]["NUM2"].ToString(); mtCom.ColRow["DSYH"] = table.Rows[index]["YCDS"].ToString(); mtCom.ColRow["HSJJ"] = table.Rows[index]["HSJJ"].ToString(); mtCom.ColRow["OPERGH"] = UserAction.UserID; cmdList.Add(mtCom.Insert()); } OracleParameter[] parameters = new OracleParameter[] { new OracleParameter("V_seqno", OracleDbType.Varchar2) }; parameters[0].Value = billno; cmdList.Add(new CommandInfo("P_DS2CK", parameters, CommandType.StoredProcedure)); if (!DbHelperOra.ExecuteSqlTran(cmdList)) { Alert.Show("生成定数出库单失败!", "错误提示", MessageBoxIcon.Error); return; } else { Alert.Show("生成定数出库单成功!", "消息提示", MessageBoxIcon.Information); ddlDEPTOUT.SelectedValue = ""; ddlDEPTID.SelectedValue = ""; tbxGDSEQ.Text = ""; DataSearch(); } }
protected void GridDosage_RowDoubleClick(object sender, FineUIPro.GridRowClickEventArgs e) { hfdIsNew.Text = "N"; tbxCode.Enabled = false; tbxCode.Text = PubFunc.GridDataGet(GridDosage, e.RowIndex)["Code"].ToString(); tbxName.Text = PubFunc.GridDataGet(GridDosage, e.RowIndex)["Name"].ToString(); ckbFlag.Checked = PubFunc.GridDataGet(GridDosage, e.RowIndex)["FLAG"].ToString() == "Y" ? true : false; }
protected void GoodsInfo_RowDoubleClick(object sender, GridRowClickEventArgs e) { string strCode = GoodsInfo.Rows[e.RowIndex].Values[1].ToString(); DataTable table = PubFunc.GridDataGet(GoodsInfo); DataView dv = table.DefaultView; dv.RowFilter = "GDSEQ = '" + strCode + "'"; DataGridBack(dv.ToTable()); }
protected void GridList_Sort(object sender, GridSortEventArgs e) { GridList.SortDirection = e.SortDirection; GridList.SortField = e.SortField; DataView view1 = PubFunc.GridDataGet(GridList).DefaultView; view1.Sort = String.Format("{0} {1}", GridList.SortField, GridList.SortDirection); GridList.DataSource = view1; GridList.DataBind(); }
//根据行ID来删除行数据 private DataTable DeleteRowByID(int rowID) { DataTable table = PubFunc.GridDataGet(GridGoods); DataRow found = table.Rows[rowID]; if (found != null) { table.Rows.Remove(found); } return(table); }
protected void GridList_Sort(object sender, GridSortEventArgs e) { GridList.SortDirection = e.SortDirection; GridList.SortField = e.SortField; highlightRows.Text = ""; highlightRowYellow.Text = ""; highlightRowRed.Text = ""; DataTable table = PubFunc.GridDataGet(GridList); DataView view1 = table.DefaultView; view1.Sort = String.Format("{0} {1}", GridList.SortField, GridList.SortDirection); GridList.DataSource = view1; GridList.DataBind(); }
protected void GridList_Sort(object sender, GridSortEventArgs e) { GridList.SortDirection = e.SortDirection; GridList.SortField = e.SortField; DataTable table = PubFunc.GridDataGet(GridList); DataTable tbnew = table.Clone(); tbnew.Columns["SUBSUM"].DataType = typeof(double);//指定SUBSUM为double类型 foreach (DataRow s in table.Rows) { tbnew.ImportRow(s);//导入旧数据 } DataView view1 = tbnew.DefaultView; view1.Sort = String.Format("{0} {1}", GridList.SortField, GridList.SortDirection); GridList.DataSource = view1; GridList.DataBind(); }
protected void btnAudit_Click(object sender, EventArgs e) { int[] rows = GridSupplier.SelectedRowIndexArray; if (rows.Length > 0 && !string.IsNullOrEmpty(tbxSUPID.Text)) { if (PubFunc.FormDataCheck(FormProducer).Length > 1) { return; //存在为空的非空列则返回! } else { saveExec(); string strFLAG = ddlFLAG.SelectedValue.ToString(); if (strFLAG == "Y") { Alert.Show("已经审核通过,无需再审!"); } else { string strSUPID = ""; foreach (int index in rows) { strSUPID += PubFunc.GridDataGet(GridSupplier, index)["SUPID"].ToString() + ","; } strSUPID = strSUPID.TrimEnd(',').Replace(",", "','"); DbHelperOra.ExecuteSql("UPDATE DOC_SUPPLIER SET FLAG = 'Y' WHERE SUPID IN ('" + strSUPID + "')"); Alert.Show("供应商资料 审核通过!"); OperLog("供应商资料", "审核供应商【" + strSUPID + "】"); ERPUtility.CacheClear("DOC_SUPPLIER"); } } } else { Alert.Show("请选择需要审核的供应商!"); return; } String strSUPID1 = tbxSUPID.Text.ToString(); cxsj(strSUPID1); PubFunc.FormLock(FormProducer, true); dataSearch(); }
protected override void billSave() { List <Dictionary <string, object> > newDict = GridList.GetNewAddedList(); MyTable mtTypeMx = new MyTable("doc_mygoods"); List <CommandInfo> cmdList = new List <CommandInfo>(); string Sql = string.Empty; string GETdeptid = ""; string GETgdseq = ""; for (int i = 0; i < newDict.Count; i++) { GETdeptid = newDict[i]["DEPTID"].ToString(); GETgdseq = newDict[i]["GDSEQ"].ToString(); if (DbHelperOra.Exists("select 1 from DOC_MYGOODS where DEPTID='" + GETdeptid + "' and GDSEQ ='" + GETgdseq + "'")) { Sql = "DELETE FROM DOC_MYGOODS WHERE DEPTID = '" + GETdeptid + "' and GDSEQ = '" + GETgdseq + "'"; cmdList.Add(new CommandInfo(Sql, null)); } mtTypeMx.ColRow = PubFunc.GridDataGet(newDict[i]); mtTypeMx.ColRow.Remove("DEPTIDNAME"); mtTypeMx.ColRow.Remove("GDNAME"); mtTypeMx.ColRow.Remove("GDSPEC"); mtTypeMx.ColRow.Remove("UNITNAME"); mtTypeMx.ColRow.Remove("BZHL"); mtTypeMx.ColRow.Remove("ZDKC"); mtTypeMx.ColRow.Remove("ZGKC"); mtTypeMx.ColRow.Remove("DSNUM"); mtTypeMx.ColRow.Remove("NUM1"); mtTypeMx.ColRow.Remove("NUM2"); mtTypeMx.ColRow.Remove("NUM3"); mtTypeMx.ColRow.Remove("OPERDATE"); cmdList.Add(mtTypeMx.Insert()); } if (DbHelperOra.ExecuteSqlTran(cmdList)) { Alert.Show("保存成功!"); } else { Alert.Show("保存失败!"); } }
protected void GoodsInfo_RowDoubleClick(object sender, GridRowClickEventArgs e) { string strIsds = GoodsInfo.Rows[e.RowIndex].Values[1].ToString(); string strCode = GoodsInfo.Rows[e.RowIndex].Values[2].ToString(); string strDsCode = GoodsInfo.Rows[e.RowIndex].Values[6].ToString(); DataTable table = PubFunc.GridDataGet(GoodsInfo); DataView dv = table.DefaultView; if (string.IsNullOrWhiteSpace(strDsCode)) { dv.RowFilter = "GDSEQ = '" + strCode + "' AND ISDS = '" + strIsds + "'"; } else { dv.RowFilter = "GDSEQ = '" + strCode + "' AND ISDS = '" + strIsds + "' AND DSCODE = '" + strDsCode + "'"; } //DataTable dt = DbHelperOra.Query(strSql).Tables[0]; DataGridBack(dv.ToTable()); }
protected void btnDelete_Click(object sender, EventArgs e) { int[] rows = GridSupplier.SelectedRowIndexArray; if (rows.Length > 0) { string code = ""; foreach (int index in rows) { code += PubFunc.GridDataGet(GridSupplier, index)["SUPID"].ToString() + ","; } code = code.TrimEnd(',').Replace(",", "','"); DbHelperOra.ExecuteSql("DELETE FROM DOC_SUPPLIER WHERE SUPID IN ('" + code + "')"); Alert.Show("供应商【" + code + "】删除成功!"); dataSearch(); } else { Alert.Show("请选择要删除的供应商!"); } }
protected void btnDelete_Click(object sender, EventArgs e) { int[] rows = GridProducer.SelectedRowIndexArray; if (rows.Length > 0) { string code = ""; foreach (int index in rows) { code += PubFunc.GridDataGet(GridProducer, index)["CODE"].ToString() + ","; } code = code.TrimEnd(',').Replace(",", "','"); DbHelperOra.ExecuteSql("DELETE FROM DOC_PRODUCER WHERE CODE IN ('" + code + "')"); Alert.Show("生产厂家信息删除成功!"); dataSearch(); } else { Alert.Show("请选择要删除的生产厂家信息!"); } }
protected void btnDelete_Click(object sender, EventArgs e) { int[] rows = GridDosage.SelectedRowIndexArray; if (rows.Length > 0) { string code = ""; foreach (int index in rows) { code += PubFunc.GridDataGet(GridDosage, index)["Code"].ToString() + ","; } //DbHelperOra.ExecuteSql("UPDATE DOC_GOODSJX SET ISDELETE='Y' WHERE CODE IN ('" + code.TrimEnd(',').Replace(",", "','") + "')"); DbHelperOra.ExecuteSql("delete DOC_GOODSJX WHERE CODE IN ('" + code.TrimEnd(',').Replace(",", "','") + "')"); OperLog("剂型资料", "删除剂型【" + code.TrimEnd(',') + "】"); Alert.Show("商品剂型信息删除成功!"); GetDosage(); } else { Alert.Show("请选择要删除的商品剂型信息!"); } }
protected void btnDelete_Click(object sender, EventArgs e) { int[] rows = GridUnit.SelectedRowIndexArray; string code = ""; foreach (int index in rows) { code += PubFunc.GridDataGet(GridUnit, index)["Code"].ToString() + ","; } if (code.Trim() == "") { Alert.Show("请选择需要删除的信息"); return; } // DbHelperOra.ExecuteSql("UPDATE DOC_GOODSUNIT SET ISDELETE='Y' WHERE CODE IN ('" + code.TrimEnd(',').Replace(",", "','") + "')"); DbHelperOra.ExecuteSql("DELETE DOC_GOODSUNIT WHERE CODE IN ('" + code.TrimEnd(',').Replace(",", "','") + "')"); OperLog("单位资料", "删除单位【" + code.TrimEnd(',') + "】"); Alert.Show("单位信息删除成功!"); LoadData(); }
private void save(string flag = "Y") { #region 数据有效性验证 if ((",M,R").IndexOf(docFLAG.SelectedValue) < 0) { Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning); return; } List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList(); if (newDict.Count == 0) { Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning); return; } if (PubFunc.FormDataCheck(FormDoc).Length > 0) { return; } List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >(); //判断是否有空行、批号填写是否符合要求 for (int i = 0; i < newDict.Count; i++) { if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString())) { //填写商品追溯码时,使用数必须为小于等于1 if (newDict[i]["NUM1"].ToString() == newDict[i]["NUM2"].ToString()) { Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】调整与原设定相同,请检查!", "提示信息", MessageBoxIcon.Warning); return; } goodsData.Add(newDict[i]); } } if (goodsData.Count == 0)//所有Gird行都为空行时 { Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning); return; } #endregion if (PubFunc.StrIsEmpty(docBILLNO.Text)) { docBILLNO.Text = BillSeqGet(); docBILLNO.Enabled = false; } else { string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'M') FROM DAT_DT_DOC WHERE SEQNO='{0}'", docBILLNO.Text)); if (!string.IsNullOrWhiteSpace(flg) && (",M,R").IndexOf(flg) < 0) { Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning); return; } else { docBILLNO.Enabled = false; } } MyTable mtType = new MyTable("DAT_DT_DOC"); mtType.ColRow = PubFunc.FormDataHT(FormDoc); mtType.ColRow["SEQNO"] = docBILLNO.Text; mtType.ColRow["FLAG"] = "M"; mtType.ColRow.Add("BILLTYPE", BillType); mtType.ColRow.Add("SUBNUM", goodsData.Count); mtType.ColRow.Add("XSTYPE", "1"); List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtTypeMx = new MyTable("DAT_DT_COM"); //先删除单据信息在插入 cmdList.Add(new CommandInfo("delete DAT_DT_DOC where seqno='" + docBILLNO.Text + "'", null)); //删除单据台头 cmdList.Add(new CommandInfo("delete DAT_DT_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细 for (int i = 0; i < goodsData.Count; i++) { mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]); mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text); mtTypeMx.ColRow["ROWNO"] = i + 1; mtTypeMx.ColRow.Remove("UNITNAME"); mtTypeMx.ColRow.Remove("PRODUCERNAME"); cmdList.Add(mtTypeMx.Insert()); } cmdList.AddRange(mtType.InsertCommand()); //增加待办事宜 cmdList.Add(Doc.GETDOADD("DO_13", docDEPTID.SelectedValue, docLRY.SelectedValue, docBILLNO.Text.Trim())); if (DbHelperOra.ExecuteSqlTran(cmdList)) { Alert.Show("高值修改信息保存成功!"); OperLog("高值调整", "修改单据【" + docBILLNO.Text + "】"); billOpen(docBILLNO.Text); } SaveSuccess = true; }
private void save(string flag = "N") { #region 数据有效性验证 if (docFLAG.SelectedValue != "N") { Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning); return; } List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList(); if (newDict.Count == 0) { Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning); return; } if (PubFunc.FormDataCheck(FormDoc).Length > 0) { return; } decimal subsum = 0; List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >(); //判断是否有空行、批号填写是否符合要求 for (int i = 0; i < newDict.Count; i++) { if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString())) { //if (newDict[i]["ISLOT"].ToString() == "1" || newDict[i]["ISLOT"].ToString() == "2") //{ // if (string.IsNullOrWhiteSpace(newDict[i]["PH"].ToString()) || newDict[i]["PH"].ToString() == "\\") // { // //GridGoods.SelectedCell = new int[] { i, 8 }; // string[] selectedCell = GridGoods.SelectedCell; // PageContext.RegisterStartupScript(String.Format("F('{0}').selectCell('{1}','{2}');", GridGoods.ClientID, selectedCell[0], "KCSL")); // Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】批号不能为空!!!", "消息提示", MessageBoxIcon.Warning); // return; // } //} //if (newDict[i].ContainsKey("STR1")&&goodsData.Count > 0 && goodsData.Where(x => x["STR1"].ToString() == newDict[i]["STR1"].ToString()).Count() > 0) //{ // Alert.Show("条码[" + newDict[i]["STR1"] + "]扫描重复!", "消息提示", MessageBoxIcon.Warning); // return; if (!string.IsNullOrWhiteSpace(newDict[i]["STR1"].ToString())) { for (int k = 1 + i; k < newDict.Count; k++) { if ((newDict[i]["STR1"].ToString()) == (newDict[k]["STR1"].ToString())) { Alert.Show("商品『" + newDict[k]["GDNAME"].ToString() + "』条码『" + newDict[k]["STR1"].ToString() + "』重复,请维护!", "消息提示", MessageBoxIcon.Warning); return; } } } if (newDict[i]["BZSL"].ToString() == "0" || string.IsNullOrWhiteSpace(newDict[i]["BZSL"].ToString())) { Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】使用数填写不正确!", "消息提示", MessageBoxIcon.Warning); return; } if (decimal.Parse(newDict[i]["KCSL"].ToString()) < decimal.Parse(newDict[i]["BZSL"].ToString())) { Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】使用数大于库存数,请重新输入!", "消息提示", MessageBoxIcon.Warning); return; } //当商品中含有贵重商品信息,即需要赋唯一码时 if (newDict[i]["ISGZ"].ToString() == "Y" && newDict[i]["ONECODE"].ToString() == "") { Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】为贵重商品,请先进行扫描赋码!", "消息提示", MessageBoxIcon.Warning); return; } goodsData.Add(newDict[i]); subsum += Convert.ToDecimal(newDict[i]["HSJJ"].ToString()) * Convert.ToDecimal(newDict[i]["BZHL"].ToString()); } } if (goodsData.Count == 0)//所有Gird行都为空行时 { Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning); return; } //验证单据信息 if (DbHelperOra.Exists("SELECT 1 FROM DAT_XS_DOC where seqno = '" + docBILLNO.Text + "'") && docBILLNO.Enabled) { Alert.Show("您输入的单号已存在,请检查!"); return; } #endregion if (PubFunc.StrIsEmpty(docBILLNO.Text)) { docSEQNO.Text = BillSeqGet(); docBILLNO.Text = docSEQNO.Text; docBILLNO.Enabled = false; } else { string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_XS_DOC WHERE SEQNO='{0}'", docBILLNO.Text)); if (!string.IsNullOrWhiteSpace(flg) && (",N,R").IndexOf(flg) < 0) { Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning); return; } else { docSEQNO.Text = docBILLNO.Text; docBILLNO.Enabled = false; } } MyTable mtType = new MyTable("DAT_XS_DOC"); mtType.ColRow = PubFunc.FormDataHT(FormDoc); mtType.ColRow["SEQNO"] = docBILLNO.Text; mtType.ColRow.Add("BILLTYPE", BillType); mtType.ColRow.Add("SUBNUM", goodsData.Count); mtType.ColRow.Add("XSTYPE", "1"); List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtTypeMx = new MyTable("DAT_XS_COM"); //先删除单据信息在插入 cmdList.Add(new CommandInfo("delete DAT_XS_DOC where seqno='" + docBILLNO.Text + "'", null)); //删除单据台头 cmdList.Add(new CommandInfo("delete DAT_XS_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细 decimal subNum = 0; for (int i = 0; i < goodsData.Count; i++) { mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]); if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["BZSL"].ToString()) || mtTypeMx.ColRow["BZSL"].ToString() == "0") { Alert.Show("商品【" + mtTypeMx.ColRow["GDSEQ"] + " | " + mtTypeMx.ColRow["GDNAME"] + "】【使用数】为0或空,无法进行【使用信息管理】操作。"); return; } mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text); mtTypeMx.ColRow["ROWNO"] = i + 1; mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]); mtTypeMx.ColRow["DHSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()); mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()); //mtTypeMx.ColRow["XSSL"] = goodsData[i]["DHSL"].ToString(); mtTypeMx.ColRow["XSSL"] = mtTypeMx.ColRow["DHSL"]; mtTypeMx.ColRow.Add("BHSJJ", 0); mtTypeMx.ColRow.Add("BHSJE", 0); mtTypeMx.ColRow.Remove("UNITNAME"); mtTypeMx.ColRow.Remove("PRODUCERNAME"); subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString()); cmdList.Add(mtTypeMx.Insert()); } mtType.ColRow.Add("SUBSUM", subNum); cmdList.AddRange(mtType.InsertCommand()); if (DbHelperOra.ExecuteSqlTran(cmdList)) { if (flag == "N") { Alert.Show("商品使用信息保存成功!"); } OperLog("使用管理", "修改单据【" + docBILLNO.Text + "】"); billOpen(docBILLNO.Text); } SaveSuccess = true; }
protected void btnOk() { if (Doc.DbGetSysPara("LOCKSTOCK") == "Y") { Alert.Show("系统库存已被锁定,请等待物资管理科结存处理完毕再做审核处理!", "消息提醒", MessageBoxIcon.Warning); return; } #region 数据有效性验证 decimal subsum = 0;//总金额 if (docFLAG.SelectedValue != "S") { Alert.Show("非『已审批』单据不能申领确定!", "提示信息", MessageBoxIcon.Warning); return; } List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList(); if (newDict.Count == 0) { Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning); return; } //验证科室是否盘点 if (DbHelperOra.Exists("SELECT 1 FROM DAT_PD_LOCK WHERE DEPTID IN('" + docDEPTOUT.SelectedValue + "','" + docDEPTID.SelectedValue + "') AND FLAG='N'")) { Alert.Show("出库或申领科室正在盘点,请检查!"); return; } List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >(); //判断是否有空行 for (int i = 0; i < newDict.Count; i++) { if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString())) { goodsData.Add(newDict[i]); subsum = subsum + decimal.Parse(newDict[i]["HSJE"].ToString()); } } if (goodsData.Count == 0)//所有Gird行都为空行时 { Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning); return; } //验证单据信息 if (DbHelperOra.Exists("SELECT 1 FROM DAT_CK_DOC WHERE SEQNO = '" + docBILLNO.Text + "'") && docBILLNO.Enabled) { Alert.Show("您输入的单号已存在,请检查!"); return; } #endregion if (PubFunc.StrIsEmpty(docBILLNO.Text)) { docSEQNO.Text = BillSeqGet(); docBILLNO.Text = docSEQNO.Text; docBILLNO.Enabled = false; } else { string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_CK_DOC WHERE SEQNO='{0}'", docBILLNO.Text)); if (!PubFunc.StrIsEmpty(flg) && (",N,R,S").IndexOf(flg) < 0) { Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning); return; } else { docSEQNO.Text = docBILLNO.Text; docBILLNO.Enabled = false; } } MyTable mtType = new MyTable("DAT_CK_DOC"); mtType.ColRow = PubFunc.FormDataHT(FormDoc); mtType.ColRow["SEQNO"] = docBILLNO.Text; mtType.ColRow.Add("BILLTYPE", BillType); mtType.ColRow.Add("SUBNUM", goodsData.Count); mtType.ColRow.Add("SUBSUM", subsum); mtType.ColRow.Add("XSTYPE", "1"); List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtTypeMx = new MyTable("DAT_CK_COM"); //MyTable mtTypeExt = new MyTable("DAT_CK_EXT"); //先删除单据信息在插入 cmdList.Add(mtType.DeleteCommand("")); //删除单据台头 cmdList.Add(new CommandInfo("delete dat_ck_com where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细 cmdList.AddRange(mtType.InsertCommand()); for (int i = 0; i < goodsData.Count; i++) { mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]); mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text); mtTypeMx.ColRow["ROWNO"] = i + 1; mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]); mtTypeMx.ColRow["XSSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()); mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()); if (decimal.Parse(mtTypeMx.ColRow["XSSL"].ToString()) < 0 || (decimal.Parse(mtTypeMx.ColRow["XSSL"].ToString()) > decimal.Parse(mtTypeMx.ColRow["DHSL"].ToString()) && (mtTypeMx.ColRow["NUM1NAME"].ToString() == "非赠品"))) { Alert.Show("单据号中存在拣货数量小于0或拣货数量大于申领数量!", "消息提示", MessageBoxIcon.Warning); return; } mtTypeMx.ColRow.Add("BHSJJ", 0); mtTypeMx.ColRow.Add("BHSJE", 0); mtTypeMx.ColRow.Remove("UNITNAME"); mtTypeMx.ColRow.Remove("PRODUCERNAME"); cmdList.Add(mtTypeMx.Insert()); } OracleParameter[] parameters = { new OracleParameter("VTASKID", OracleDbType.Varchar2, 20), new OracleParameter("VPARA", OracleDbType.Varchar2, 800) }; parameters[0].Value = BillType; parameters[1].Value = "'" + docBILLNO.Text + "','" + BillType + "','" + UserAction.UserID + "','AUDIT'"; cmdList.Add(new CommandInfo("P_EXECTASK", parameters, CommandType.StoredProcedure)); bool flag = false; try { flag = DbHelperOra.ExecuteSqlTran(cmdList); } catch (Exception ex) { Alert.Show(errorParse(ex.Message), "消息提示", MessageBoxIcon.Warning); return; } if (flag) { billLockDoc(true); //增加待办事宜 DbHelperOra.ExecuteSql("UPDATE DAT_DO_LIST SET FLAG = 'Y' WHERE PARA='" + docBILLNO.Text.Trim() + "'"); if (DbHelperOra.Exists("select 1 from dat_ck_com where seqno = '" + docBILLNO.Text.Trim() + "' and gdseq in (select gdseq from doc_goods where catid0 = 1 )") == true) { Alert.Show("商品出库确认完成!需要打印试剂条码!", "消息提示", MessageBoxIcon.Information); } else { Alert.Show("商品出库确认完成!", "消息提示", MessageBoxIcon.Information); OperLog("科室申领", "出库确认单据【" + docBILLNO.Text + "】"); } billOpen(docBILLNO.Text); } else { Alert.Show("商品出库确认出错!!!", "错误提示", MessageBoxIcon.Error); } }
private void save(string flag = "N") { #region 数据有效性验证 if ((",M,R").IndexOf(ddlFLAG.SelectedValue) < 0) { Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning); return; } if (PubFunc.FormDataCheck(FormDoc).Length > 0) { return; } if (GridGoods.Rows.Count() == 0) { Alert.Show("请先进行数据维护,再进行保存操作!", "消息提示", MessageBoxIcon.Warning); return; } //验证单据信息 if (DbHelperOra.Exists("SELECT 1 FROM DAT_TZSUP_DOC where seqno = '" + tbxBILLNO.Text + "'") && tbxBILLNO.Enabled) { Alert.Show("您输入的单号已存在,请检查!"); return; } #endregion if (PubFunc.StrIsEmpty(tbxBILLNO.Text)) { tbxSEQNO.Text = BillSeqGet(); tbxBILLNO.Text = tbxSEQNO.Text; tbxBILLNO.Enabled = false; } else { string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'M') FROM DAT_TZSUP_DOC WHERE SEQNO='{0}'", tbxBILLNO.Text)); if (!string.IsNullOrWhiteSpace(flg) && (",M,R").IndexOf(flg) < 0) { Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning); return; } else { tbxSEQNO.Text = tbxBILLNO.Text; tbxBILLNO.Enabled = false; } } MyTable mtType = new MyTable("DAT_TZSUP_DOC"); mtType.ColRow = PubFunc.FormDataHT(FormDoc); mtType.ColRow["SEQNO"] = tbxBILLNO.Text; mtType.ColRow.Add("SUBNUM", GridGoods.Rows.Count); mtType.ColRow.Add("XGTYPE", ddlType.SelectedValue); mtType.ColRow.Add("BILLTYPE", "TZL"); mtType.ColRow["FLAG"] = "M"; List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtTypeMx = new MyTable("DAT_TZSUP_COM"); //先删除单据信息在插入 cmdList.Add(new CommandInfo("delete DAT_TZSUP_DOC where seqno='" + tbxBILLNO.Text + "'", null)); //删除单据台头 cmdList.Add(new CommandInfo("delete DAT_TZSUP_COM where seqno='" + tbxBILLNO.Text + "'", null)); //删除单据明细 cmdList.AddRange(mtType.InsertCommand()); int index = 0; foreach (GridRow row in GridGoods.Rows) { index++; mtTypeMx.ColRow = PubFunc.GridDataGet(row); mtTypeMx.ColRow["SEQNO"] = tbxBILLNO.Text; mtTypeMx.ColRow["ROWNO"] = index; cmdList.Add(mtTypeMx.Insert()); } if (DbHelperOra.ExecuteSqlTran(cmdList)) { Alert.Show("供应商信息保存成功!"); OperLog("供应商管理", "修改单据【" + tbxBILLNO.Text + "】"); billOpen(tbxBILLNO.Text); } SaveSuccess = true; }
private void save(string flag = "N") { #region 数据有效性验证 if (docFLAG.SelectedValue != "N") { Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning); return; } List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList(); if (newDict.Count == 0) { Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning); return; } List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >(); //判断是否有空行 for (int i = 0; i < newDict.Count; i++) { if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString())) { if (newDict[i]["BZSL"].ToString() == "0" || string.IsNullOrWhiteSpace(newDict[i]["BZSL"].ToString())) { Alert.Show("第【" + (i + 1) + "】行【调拨数量】为空,请填写!"); return; } object DSBZSL = DbHelperOra.GetSingle(string.Format(@"SELECT DSHL FROM DAT_GOODSDS_LOG WHERE GDSEQ = '{0}' AND DEPTIN = '{1}' AND BARCODE = '{2}'", newDict[i]["GDSEQ"].ToString(), docDEPTOUT.SelectedValue, newDict[i]["DSCODE"].ToString())); object FDSKC = DbHelperOra.GetSingle(string.Format(@"SELECT (A.KCSL - NVL(B.DSSL, 0)) KSSPSL FROM (SELECT GDSEQ, SUM(KCSL) KCSL FROM DAT_GOODSSTOCK A WHERE KCSL > 0 AND A.DEPTID = '{1}' AND A.GDSEQ = '{0}' GROUP BY GDSEQ) A, (SELECT GDSEQ, SUM(DSHL) DSSL FROM DAT_GOODSDS_LOG WHERE DEPTIN = '{1}' AND FLAG = 'N' AND SL > 0 AND DSHL > 0 AND GDSEQ = '{0}' GROUP BY GDSEQ) B WHERE A.GDSEQ = B.GDSEQ(+)", newDict[i]["GDSEQ"].ToString(), docDEPTOUT.SelectedValue)); if (string.IsNullOrWhiteSpace(newDict[i]["PH"].ToString())) { Alert.Show("第【" + (i + 1) + "】行【批号】为空,请填写!"); return; } //if (newDict[i]["ISDS"].ToString() == "定数") if (!string.IsNullOrWhiteSpace(newDict[i]["DSCODE"].ToString())) { //if (newDict[i]["BZSL"].ToString() != newDict[i]["DSBZSL"].ToString()) if (newDict[i]["BZSL"].ToString() != DSBZSL.ToString()) { //newDict[i]["BZSL"] = newDict[i]["DSBZSL"].ToString(); Alert.Show("第【" + (i + 1) + "】行为定数,【调拨数量】不允许由【" + DSBZSL.ToString() + "】调整为【" + newDict[i]["BZSL"].ToString() + "】,请修改!"); return; } } else { if (Convert.ToDecimal(newDict[i]["BZSL"].ToString()) > Convert.ToDecimal(FDSKC.ToString())) { //newDict[i]["BZSL"] = newDict[i]["DSBZSL"].ToString(); Alert.Show("第【" + (i + 1) + "】行为非定数,不允许大于非定数库存数量【" + FDSKC.ToString() + "】,请修改!"); return; } } goodsData.Add(newDict[i]); } } if (goodsData.Count == 0)//所有Gird行都为空行时 { Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning); return; } //验证单据信息 if (DbHelperOra.Exists("SELECT 1 FROM dat_kd_doc where seqno = '" + docBILLNO.Text + "'") && docBILLNO.Enabled) { Alert.Show("您输入的单号已存在,请检查!"); return; } #endregion if (PubFunc.StrIsEmpty(docBILLNO.Text)) { docSEQNO.Text = BillSeqGet(); //重新拼单号 docSEQNO.Text = "KSD" + docSEQNO.Text.Substring(3, docSEQNO.Text.Length - 3); docBILLNO.Text = docSEQNO.Text; docBILLNO.Enabled = false; } MyTable mtType = new MyTable("DAT_KD_DOC"); mtType.ColRow = PubFunc.FormDataHT(FormDoc); mtType.ColRow["SEQNO"] = docBILLNO.Text; mtType.ColRow.Add("BILLTYPE", "KSD"); mtType.ColRow.Add("SUBNUM", goodsData.Count); mtType.ColRow.Add("XSTYPE", "1"); List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtTypeMx = new MyTable("DAT_KD_COM"); decimal subNum = 0; //总金额 //先删除单据信息在插入 cmdList.Add(mtType.DeleteCommand("")); //删除单据台头 cmdList.Add(new CommandInfo("DELETE DAT_KD_COM WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据明细 for (int i = 0; i < goodsData.Count; i++) { mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]); mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text); mtTypeMx.ColRow["ROWNO"] = i + 1; mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]); mtTypeMx.ColRow.Add("XSSL", Convert.ToInt32(mtTypeMx.ColRow["BZHL"]) * Convert.ToInt32(mtTypeMx.ColRow["BZSL"])); mtTypeMx.ColRow["HSJE"] = Convert.ToDecimal(mtTypeMx.ColRow["XSSL"]) * Convert.ToDecimal(mtTypeMx.ColRow["HSJJ"]); mtTypeMx.ColRow.Add("BHSJJ", 0); mtTypeMx.ColRow.Add("BHSJE", 0); mtTypeMx.ColRow.Remove("UNITNAME"); mtTypeMx.ColRow.Remove("PRODUCERNAME"); subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString()); cmdList.Add(mtTypeMx.Insert()); } mtType.ColRow.Add("SUBSUM", subNum); cmdList.AddRange(mtType.InsertCommand()); DbHelperOra.ExecuteSqlTran(cmdList); if (flag == "N") { Alert.Show("科室商品调拨信息保存成功!"); } //billNew(); OperLog("科室调拨", "修改单据【" + docBILLNO.Text.Trim() + "】"); billOpen(docBILLNO.Text); btnDel.Enabled = true; billLockDoc(true); SaveSuccess = true; }
protected void btnGoodsConfig_Click(object sender, EventArgs e) { int[] deptArray = GridDepartment.SelectedRowIndexArray; string strGoods = ""; string strGoodsTR = ""; if (deptArray.Length > 0) { int[] selectArray = GridGoodsConfig.SelectedRowIndexArray; //if (selectArray.Length > 0) //{ List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable myGoodsCFG = new MyTable("DOC_GOODSCFG"); for (int j = 0; j < selectArray.Length; j++) { cmdList.Add(new CommandInfo(string.Format("delete doc_goodscfg where gdseq='{0}'", GridGoodsConfig.Rows[selectArray[j]].Values[1].ToString()), null)); } DataTable dtcfggrid = DbHelperOra.QueryForTable(string.Format(@"SELECT DEPTID FROM DOC_GOODSCFG WHERE GDSEQ='{0}'", GridGoodsConfig.Rows[GridGoodsConfig.SelectedRowIndex].Values[1].ToString())); bool isexist = false; if (dtcfggrid.Rows.Count > 0) { DataTable canceldt = PubFunc.GridDataGet(GridDepartment, GridDepartment.SelectedRowIndexArray); canceldt.Columns.Remove("DEPTNAME"); canceldt.Columns.Remove("DEPTTYPE"); foreach (DataRow dr in dtcfggrid.Rows) { foreach (DataRow drs in canceldt.Rows) { if (dr["DEPTID"].ToString().Equals(drs["CODE"].ToString())) { isexist = true; break; } else { isexist = false; } } if (!isexist) { DataTable dtcfgdb = DbHelperOra.QueryForTable(string.Format(@"SELECT DGC.DEPTID,SD.NAME DEPTNAME FROM DOC_GOODSCFG DGC ,SYS_DEPT SD WHERE DGC.DEPTID=SD.CODE AND (SELECT f_getkcgdseq(SD.CODE,DGC.GDSEQ,'') FROM DUAL)>0 AND SD.CODE='{0}' AND DGC.GDSEQ='{1}'", dr["DEPTID"].ToString(), GridGoodsConfig.Rows[GridGoodsConfig.SelectedRowIndex].Values[1].ToString())); if (dtcfgdb.Rows.Count > 0) { foreach (DataRow dre in dtcfgdb.Rows) { Alert.Show("科室【" + dre["DEPTNAME"].ToString() + "】中此商品尚有库存,不能取消配置"); return; } } } } for (int i = 0; i < deptArray.Length; i++) { string strDEPT = GridDepartment.Rows[deptArray[i]].Values[0].ToString(); string strTYPE = GridDepartment.Rows[deptArray[i]].Values[2].ToString(); string strInsertSql = ""; for (int j = 0; j < selectArray.Length; j++) { strGoods = "'" + GridGoodsConfig.Rows[selectArray[j]].Values[1].ToString() + "',"; strGoodsTR = strGoods.TrimEnd(','); if (strTYPE.Equals("3")) { strInsertSql = string.Format(@"INSERT INTO doc_goodscfg (GDSEQ, DEPTID, HJCODE1) VALUES({0}, '{1}', '{2}')", strGoodsTR, strDEPT, strDEPT); } else { strInsertSql = string.Format(@"INSERT INTO doc_goodscfg (GDSEQ, DEPTID, HJCODE1) VALUES({0}, '{1}', '{2}')", strGoodsTR, strDEPT, ""); } cmdList.Add(new CommandInfo(strInsertSql, null)); } #region //string strSqls = String.Format("SELECT 1 FROM DOC_GOODSCFG A,SYS_DEPT B WHERE A.DEPTID = B.CODE AND B.TYPE = '1' AND A.GDSEQ = '{0}' AND DEPTID = '{1}'", GridGoodsConfig.Rows[selectArray[j]].Values[1].ToString(), GridDepartment.Rows[selectArray[i]].Values[0].ToString()); // if ( !DbHelperOra.Exists(strSqls)) // { // //Alert.Show(string.Format("商品【{0}】已配置到库房【{1}】!", GridGoods.Rows[selectArray[i]].Values[2].ToString(), OBJ), "消息提示", MessageBoxIcon.Warning); // //return; // myGoodsCFG.ColRow.Clear(); // myGoodsCFG.ColRow.Add("GDSEQ", GridGoodsConfig.Rows[selectArray[j]].Values[1]); // myGoodsCFG.ColRow.Add("DEPTID", GridDepartment.Rows[selectArray[j]].Values[0]); // myGoodsCFG.ColRow.Add("ISCFG", "Y"); // myGoodsCFG.ColRow.Add("NUM1", "0"); // myGoodsCFG.ColRow.Add("NUM3", "0"); // myGoodsCFG.ColRow.Add("DSNUM", "0"); // if (DbHelperOra.Exists("SELECT 1 FROM SYS_DEPT WHERE CODE = '" + GridDepartment.Rows[selectArray[i]].Values[0].ToString() + "' AND TYPE IN('1','2')")) // { // trbHJCODE1.Enabled = true; // } // else // { // myGoodsCFG.ColRow.Add("HJCODE1", GridDepartment.Rows[selectArray[i]].Values[0].ToString()); // trbHJCODE1.Enabled = false; // } // cmdList.Add(myGoodsCFG.Insert()); // OperLog("商品配置", "修改科室【" + GridDepartment.Rows[selectArray[i]].Values[0] + "】商品【" + GridGoodsConfig.Rows[selectArray[j]].Values[1] + "】"); // } //if (GridGoods.Rows[selectArray[i]].Values[8].ToString() != "Y") //{ // //Alert.Show(string.Format("商品【{0}】状态信息错误!", GridGoods.Rows[selectArray[i]].Values[2].ToString()), "消息提示", MessageBoxIcon.Warning); // return; //} #endregion } } if (DbHelperOra.ExecuteSqlTran(cmdList)) { Alert.Show("保存成功"); } //} //else //{ // Alert.Show("请选择要进行配置的商品信息!"); // GridGoods.Focus(); //} } else { Alert.Show("请选择要进行配置的部门!"); ddlDept.Focus(); } }
private void DataSave(string flag) { List <Dictionary <string, object> > goodsData = GridGoods.GetNewAddedList().ToList(); if (goodsData.Count == 0)//所有Gird行都为空行时 { Alert.Show("没有任何数据!", "消息提示", MessageBoxIcon.Information); return; } if (!string.IsNullOrEmpty(docYSRQ.Text) && Convert.ToDateTime(docYSRQ.Text + "-01") < Convert.ToDateTime(DateTime.Now.AddMonths(1).ToString("yyyy-MM") + "-01")) { Alert.Show("当前时间只能做下一个月预算!", "消息提示", MessageBoxIcon.Information); return; } if (string.IsNullOrWhiteSpace(docSEQNO.Text)) { if (PubFunc.StrIsEmpty(docBILLNO.Text)) { docSEQNO.Text = BillSeqGet(); docBILLNO.Text = docSEQNO.Text; docSEQNO.Enabled = false; } decimal bzslTotal = 0, feeTotal = 0; bzslTotal = goodsData.Count(); foreach (Dictionary <string, object> dic in goodsData) { if ((dic["HSJJ"] ?? "0").ToString().Length > 0) { feeTotal += Convert.ToDecimal(dic["HSJJ"] ?? "0") * Convert.ToDecimal(dic["YSSL"] ?? "0"); } } MyTable mtType = new MyTable("DAT_YS_DOC"); mtType.ColRow["SEQNO"] = docBILLNO.Text; mtType.ColRow["BILLNO"] = docBILLNO.Text; mtType.ColRow["FLAG"] = "M"; mtType.ColRow["BILLTYPE"] = "YSD"; //单据类别为预算单 mtType.ColRow["DEPTID"] = ddlDEPTID.SelectedValue; mtType.ColRow["YSRANGE"] = Convert.ToDecimal(nbxYSSL.Text); //插入预算调整幅度 mtType.ColRow["BEGRQ"] = dpStartDate.SelectedDate; mtType.ColRow["ENDRQ"] = dpEndDate.SelectedDate; mtType.ColRow["YSRQ"] = docYSRQ.Text; mtType.ColRow["SUBNUM"] = bzslTotal.ToString(); mtType.ColRow["SUBSUM"] = feeTotal.ToString("F2"); mtType.ColRow["YSY"] = UserAction.UserID; mtType.ColRow["LRY"] = UserAction.UserID; mtType.ColRow["LRRQ"] = DateTime.Now; mtType.ColRow["SPR"] = UserAction.UserID; mtType.ColRow["SPRQ"] = DateTime.Now; mtType.ColRow["SHR"] = ""; mtType.ColRow["SHRQ"] = ""; mtType.ColRow["MEMO"] = docMEMO.Text; List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtTypeMx = new MyTable("DAT_YS_COM"); cmdList.Add(new CommandInfo("DELETE DAT_YS_COM WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据台头 cmdList.Add(new CommandInfo("DELETE DAT_YS_COM WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据明细 cmdList.AddRange(mtType.InsertCommand()); for (int i = 0; i < goodsData.Count; i++) { mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]); mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text); mtTypeMx.ColRow.Add("ROWNO", i + 1); mtTypeMx.ColRow.Add("BZHL", 0); mtTypeMx.ColRow.Remove("HSJE"); mtTypeMx.ColRow.Add("HSJE", Convert.ToDecimal(goodsData[i]["HSJJ"] ?? "0") * Convert.ToDecimal(goodsData[i]["YSSL"] ?? "0")); cmdList.Add(mtTypeMx.Insert()); } if (DbHelperOra.ExecuteSqlTran(cmdList)) { Alert.Show("预算单生成成功!!", "消息提示", MessageBoxIcon.Information); billOpen(docBILLNO.Text); OperLog("科室预算", "生成单据【" + docBILLNO.Text + "】"); btnSave.Enabled = true; btnSumbit.Enabled = true; btnPrint.Enabled = false; btnExport.Enabled = false; //btnDelRow.Enabled = false; } else { Alert.Show("预算单生成失败!", "消息提示", MessageBoxIcon.Information); btnSave.Enabled = true; return; } } else { int mycount = 0; int RowNum = goodsData.Count; Decimal CountNum = 0; for (int i = 0; i < goodsData.Count; i++) { string ss = goodsData[i]["YSSL"].ToString(); string hsje = goodsData[i]["HSJE"].ToString(); CountNum += Convert.ToDecimal(goodsData[i]["HSJE"] ?? 0); string comsql = string.Format("update dat_ys_COM com set YSSL={0},HSJE={1} where com.seqno='{2}' and com.rowno={3}", Convert.ToDecimal(ss), Convert.ToDecimal(hsje), docSEQNO.Text, i + 1); mycount = DbHelperOra.ExecuteSql(comsql); } string mysql = string.Format("update dat_ys_doc set DEPTID='{0}',YSRANGE={1},memo='{2}' ,SubNum={3},SubSum={4} where seqno='{5}'", ddlDEPTID.SelectedValue, Convert.ToDecimal(nbxYSSL.Text), docMEMO.Text, RowNum, CountNum, docSEQNO.Text); int count = DbHelperOra.ExecuteSql(mysql); if (count > 0 && mycount > 0) { if (flag == "N") { Alert.Show("预算单修改成功!", "消息提示", MessageBoxIcon.Information); } OperLog("科室预算", "修改单据【" + docBILLNO.Text + "】"); billOpen(docBILLNO.Text); btnSave.Enabled = true; btnSumbit.Enabled = true; btnPrint.Enabled = false; btnExport.Enabled = false; btnDelRow.Enabled = false; } else { Alert.Show("预算单修改失败,请检查原因!", "消息提示", MessageBoxIcon.Information); btnSave.Enabled = true; hfdFlag.Text = "false"; } } }
protected void btnCreate_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(docDEPTID.SelectedValue)) { Alert.Show("没有选择【库房】,不能生成养护单。"); return; } if (GridLeft.SelectedRowIndexArray.Length < 1) { Alert.Show("请选择需要生成的单据信息!", "提示信息", MessageBoxIcon.Warning); return; } string strSeqNo = BillSeqGet(); List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtType = new MyTable("DAT_YH_DOC"); mtType.ColRow["SEQNO"] = strSeqNo; mtType.ColRow["BILLNO"] = strSeqNo; mtType.ColRow["BILLTYPE"] = BillType.ToString(); mtType.ColRow["FLAG"] = "M"; mtType.ColRow["DEPTID"] = docDEPTID.SelectedValue; mtType.ColRow["YHRQ"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); mtType.ColRow["SUBNUM"] = GridLeft.SelectedRowIndexArray.Length; mtType.ColRow["YHY"] = UserAction.UserID; mtType.ColRow["LRY"] = UserAction.UserID; mtType.ColRow["LRRQ"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); MyTable mtTypeMx = new MyTable("DAT_YH_COM"); //先删除单据信息在插入 int i = 0; decimal decTotal = 0; foreach (int index in GridLeft.SelectedRowIndexArray) { Hashtable row = PubFunc.GridDataGet(GridLeft.Rows[index]); mtTypeMx.ColRow["SEQNO"] = strSeqNo; mtTypeMx.ColRow["ROWNO"] = i + 1; mtTypeMx.ColRow["GDSEQ"] = row["GDSEQ"]; mtTypeMx.ColRow["GDID"] = row["GDID"]; mtTypeMx.ColRow["GDNAME"] = row["GDNAME"]; mtTypeMx.ColRow["GDSPEC"] = row["GDSPEC"]; mtTypeMx.ColRow["UNIT"] = row["UNIT"]; mtTypeMx.ColRow["ISGZ"] = row["ISGZ"]; mtTypeMx.ColRow["ISLOT"] = row["ISLOT"]; mtTypeMx.ColRow["HSJJ"] = row["HSJJ"]; mtTypeMx.ColRow["KCSL"] = row["KCSL"]; mtTypeMx.ColRow["HSJE"] = row["HSJE"]; mtTypeMx.ColRow["STR1"] = row["HWID"]; mtTypeMx.ColRow["PHID"] = row["PHID"]; mtTypeMx.ColRow["YXQZ"] = row["YXQZ"]; mtTypeMx.ColRow["RQ_SC"] = row["RQ_SC"]; mtTypeMx.ColRow["HWID"] = row["HWID"]; mtTypeMx.ColRow["GDMODE"] = row["GDMODE"]; mtTypeMx.ColRow["BZHL"] = row["BZHL"]; mtTypeMx.ColRow["PIZNO"] = row["PIZNO"]; mtTypeMx.ColRow["PRODUCER"] = row["PRODUCER"]; mtTypeMx.ColRow["ZPBH"] = row["ZPBH"]; mtTypeMx.ColRow["MEMO"] = row["MEMO"]; mtTypeMx.ColRow["PICINO"] = row["PICINO"]; decTotal += decimal.Parse(row["HSJE"].ToString()); i++; cmdList.Add(mtTypeMx.Insert()); } mtType.ColRow["SUBSUM"] = decTotal; cmdList.Add(mtType.Insert()); if (DbHelperOra.ExecuteSqlTran(cmdList)) { //PubFunc.FormDataClear(fmForm); Alert.Show("商品养护信息保存成功,已生成养护单【" + strSeqNo + "】!", "消息提示", MessageBoxIcon.Information); OperLog("在库养护", "生成单据【" + strSeqNo + "】"); } //docDEPTID.Enabled = true; TabStrip1.ActiveTabIndex = 1; btnSear_Click(null, null); }
protected override void billSave() { #region 数据有效性验证 if (("MR").IndexOf(docFLAG.SelectedValue) < 0) { Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning); return; } if (!CheckFlagForM() && !CheckFlagForR()) { Alert.Show("此单据已经被别人操作,请等待操作!"); return; } if (!docBILLNO.Text.Contains(BillType) && docBILLNO.Text.Length > 0) { Alert.Show("下传单据不能保存!", "消息提示", MessageBoxIcon.Warning); return; } List <Dictionary <string, object> > goodsData = GridCom.GetNewAddedList(); if (goodsData.Count == 0) { Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning); return; } if (PubFunc.FormDataCheck(FormDoc).Length > 0) { return; } if (docDHRQ.SelectedDate == null) { Alert.Show("收货日期输入错误!"); return; } string type = DbHelperOra.GetSingle(string.Format("select TYPE from SYS_DEPT where CODE='{0}'", docDEPTID.SelectedValue)).ToString(); List <Dictionary <string, object> > newDict = new List <Dictionary <string, object> >(); //判断是否有空行、批号填写是否符合要求 for (int i = 0; i < goodsData.Count; i++) { if (!string.IsNullOrWhiteSpace(goodsData[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(goodsData[i]["GDNAME"].ToString())) { if ((goodsData[i]["BZSL"] ?? "").ToString() == "" || (goodsData[i]["BZSL"] ?? "").ToString() == "0") { Alert.Show("请填写商品[" + goodsData[i]["GDSEQ"] + "]入库数!", "消息提示", MessageBoxIcon.Warning); return; } if ((goodsData[i]["HSJJ"] ?? "").ToString() == "" || (goodsData[i]["HSJJ"] ?? "").ToString() == "0" || Convert.ToDecimal(goodsData[i]["HSJJ"]) == 0) { Alert.Show("商品[" + goodsData[i]["GDSEQ"] + "]的【含税进价】不能为零,请维护好商品的含税进价,再次保存!", "消息提示", MessageBoxIcon.Warning); return; } //当入库部门为1药库、2药房时 if ((",1,2").IndexOf(type) > 0 && string.IsNullOrWhiteSpace(goodsData[i]["HWID"].ToString())) { Alert.Show("第[" + (i + 1) + "]行商品【" + goodsData[i]["GDNAME"].ToString() + "】货位不能为空!!!", "消息提示", MessageBoxIcon.Warning); return; } else { if (string.IsNullOrWhiteSpace(goodsData[i]["HWID"].ToString())) { goodsData[i]["HWID"] = docDEPTID.SelectedValue; } } newDict.Add(goodsData[i]); } } if (newDict.Count == 0)//所有Gird行都为空行时 { Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning); return; } #endregion if (PubFunc.StrIsEmpty(docBILLNO.Text)) { docSEQNO.Text = BillSeqGet(); docBILLNO.Text = docSEQNO.Text; docBILLNO.Enabled = false; } else { string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'M') FROM DAT_YRK_DOC WHERE SEQNO='{0}'", docBILLNO.Text)); if (!PubFunc.StrIsEmpty(flg) && (",M,R").IndexOf(flg) < 0) { Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning); return; } else { docSEQNO.Text = docBILLNO.Text; docBILLNO.Enabled = false; } } if (docBILLNO.Text.Length > 15) { Alert.Show("单据编号输入超长,请检查!"); return; } MyTable mtType = new MyTable("DAT_YRK_DOC"); mtType.ColRow = PubFunc.FormDataHT(FormDoc); mtType.ColRow["SEQNO"] = docBILLNO.Text; mtType.ColRow["FLAG"] = "M"; mtType.ColRow.Add("BILLTYPE", BillType); mtType.ColRow.Add("SUBNUM", newDict.Count); mtType.ColRow.Add("PPSID", docPSSID.SelectedValue); //mtType.ColRow.Add("SUPNAME", docSUPID.SelectedText); List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtTypeMx = new MyTable("DAT_YRK_COM"); //取消高值写入逻辑 //MyTable mtTypeExt = new MyTable("DAT_RK_EXT"); MyTable mtTypePh = new MyTable("DOC_GOODSPH"); decimal subNum = 0; //总金额 //先删除单据信息在插入 cmdList.Add(new CommandInfo("delete DAT_YRK_DOC where seqno='" + docBILLNO.Text + "'", null)); //删除单据台头 cmdList.Add(new CommandInfo("delete DAT_YRK_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细 newDict = newDict.OrderBy(x => x["GDSEQ"]).ToList(); //按照商品编码重新排序 for (int i = 0; i < newDict.Count; i++) { mtTypeMx.ColRow = PubFunc.GridDataGet(newDict[i]); mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text); mtTypeMx.ColRow.Add("ROWNO", i + 1); mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]); mtTypeMx.ColRow.Add("BHSJJ", 0); mtTypeMx.ColRow.Add("BHSJE", 0); mtTypeMx.ColRow.Add("SSSL", 0); mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()); subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString()); mtTypeMx.ColRow["DDSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()); string codeInfo = newDict[i]["CODEINFO"].ToString(); mtTypeMx.ColRow.Remove("CODEINFO"); cmdList.Add(mtTypeMx.Insert()); } mtType.ColRow.Add("SUBSUM", subNum); if (PubFunc.StrIsEmpty(mtType.ColRow["NUM1"].ToString())) { mtType.ColRow.Remove("NUM1"); } cmdList.AddRange(mtType.InsertCommand()); if (DbHelperOra.ExecuteSqlTran(cmdList)) { Alert.Show("商品入库数据保存成功!"); billOpen(docBILLNO.Text); billLockDoc(true); OperLog("跟台商品入库", "修改单据【" + docBILLNO.Text + "】"); } else { Alert.Show("商品入库数据保存失败!", "错误提示", MessageBoxIcon.Error); } }
protected override void billSave() { #region 数据有效性验证 if (docFLAG.SelectedValue != "N") { Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning); return; } List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList(); if (newDict.Count == 0) { Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning); return; } List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >(); //判断是否有空行 for (int i = 0; i < newDict.Count; i++) { if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString())) { goodsData.Add(newDict[i]); } } if (goodsData.Count == 0)//所有Gird行都为空行时 { Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning); return; } //验证单据信息 if (DbHelperOra.Exists("SELECT 1 FROM dat_ck_doc where seqno = '" + docBILLNO.Text + "'") && docBILLNO.Enabled) { Alert.Show("您输入的单号已存在,请检查!"); return; } #endregion if (PubFunc.StrIsEmpty(docBILLNO.Text)) { docSEQNO.Text = BillSeqGet(); //处理单号前缀 docSEQNO.Text = "DSC" + docSEQNO.Text.Substring(3, docSEQNO.Text.Length - 3); docBILLNO.Text = docSEQNO.Text; docBILLNO.Enabled = false; } MyTable mtType = new MyTable("DAT_CK_DOC"); mtType.ColRow = PubFunc.FormDataHT(FormDoc); mtType.ColRow["SEQNO"] = docBILLNO.Text; mtType.ColRow.Add("BILLTYPE", "DSC"); mtType.ColRow.Add("SUBNUM", goodsData.Count); mtType.ColRow.Add("XSTYPE", "1"); decimal subNum = 0;//总金额 List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtTypeMx = new MyTable("DAT_CK_COM"); //先删除单据信息在插入 cmdList.Add(mtType.DeleteCommand("")); //删除单据台头 cmdList.Add(new CommandInfo("delete dat_ck_com where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细 for (int i = 0; i < goodsData.Count; i++) { mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]); //判断含税进价,为0时不能保存 string isJiFei = string.Format("select 1 from DOC_GOODS t where iscf = 'N' and gdseq = '{0}'", mtTypeMx.ColRow["GDSEQ"].ToString()); if (DbHelperOra.Exists(isJiFei)) { if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["HSJJ"].ToString()) || mtTypeMx.ColRow["HSJJ"].ToString() == "0") { Alert.Show("商品【含税进价】为0或空,无法进行【定数出库管理】操作。"); return; } } mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text); mtTypeMx.ColRow.Add("ROWNO", i + 1); mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]); mtTypeMx.ColRow.Add("XSSL", 0); mtTypeMx.ColRow.Add("BHSJJ", 0); mtTypeMx.ColRow.Add("BHSJE", 0); mtTypeMx.ColRow.Remove("UNITNAME"); mtTypeMx.ColRow.Remove("PRODUCERNAME"); subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString()); cmdList.Add(mtTypeMx.Insert()); } mtType.ColRow.Add("SUBSUM", subNum); cmdList.AddRange(mtType.InsertCommand()); DbHelperOra.ExecuteSqlTran(cmdList); Alert.Show("定数出库信息保存成功!"); //billNew(); billOpen(docBILLNO.Text); billLockDoc(true); }
protected bool DataSave(string flag = "N") { if (docFLAG.SelectedValue != "N") { Alert.Show("非[已提交]不能保存!", "消息提示", MessageBoxIcon.Warning); return(false); } List <Dictionary <string, object> > goodsData = GridLis.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList(); if (goodsData.Count < 1) { Alert.Show("请添加要生成养护单的商品信息!", "提示信息", MessageBoxIcon.Warning); return(false); } List <CommandInfo> cmdList = new List <CommandInfo>(); if (PubFunc.StrIsEmpty(docSEQNO.Text)) { docSEQNO.Text = BillSeqGet(); docBILLNO.Text = docSEQNO.Text; } else { if (docBILLNO.Text.Length > 16) { Alert.Show("单据编号长度不能大于16,请检查!", "消息提示", MessageBoxIcon.Warning); return(false); } docSEQNO.Text = docBILLNO.Text; } cmdList.Add(new CommandInfo("delete from dat_yh_doc where seqno='" + docSEQNO.Text + "'", null)); cmdList.Add(new CommandInfo("delete from dat_yh_com where seqno='" + docSEQNO.Text + "'", null)); MyTable mtType = new MyTable("DAT_YH_DOC"); mtType.ColRow = PubFunc.FormDataHT(Formlis); mtType.ColRow.Add("BILLTYPE", BillType); decimal decTotal = 0; MyTable mtTypeMx = new MyTable("DAT_YH_COM"); //先删除单据信息在插入 for (int i = 0; i < goodsData.Count; i++) { mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]); if (mtTypeMx.ColRow["REASON"].ToString().Length > 80) { Alert.Show("第【" + i + 1 + "】行【原因说明】字段超出规定长度"); return(false); } mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text); mtTypeMx.ColRow["ROWNO"] = i + 1; mtTypeMx.ColRow.Add("PH", mtTypeMx.ColRow["PHID"]); decTotal += decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString()); mtTypeMx.ColRow.Remove("UNITNAME"); mtTypeMx.ColRow.Remove("PRODUCERNAME"); cmdList.Add(mtTypeMx.Insert()); } mtType.ColRow.Add("SUBNUM", goodsData.Count); mtType.ColRow.Add("SUBSUM", decTotal); if (flag == "Y") { mtType.ColRow["FLAG"] = "Y"; //mtType.ColRow["SHR"] = ddlSHR.SelectedValue; mtType.ColRow["SHR"] = UserAction.UserID; mtType.ColRow["SHRQ"] = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now); } cmdList.Add(mtType.Insert()); return(DbHelperOra.ExecuteSqlTran(cmdList)); }
protected override void billSave() { List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList(); if (newDict.Count == 0) { Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning); return; } List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >(); //判断是否有空行 for (int i = 0; i < newDict.Count; i++) { if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString())) { if ((newDict[i]["XHSJJ"] ?? "").ToString().Length > 0) { if (PubFunc.StrIsEmpty(newDict[i]["UNIT"].ToString()) || !PubFunc.isNumeric(newDict[i]["XHSJJ"].ToString())) { Alert.Show("商品【" + newDict[i]["GDSEQ"] + "】信息异常,请详细检查商品信息:包装单位或价格!", "异常信息", MessageBoxIcon.Warning); return; } //原价格与现价格不能相同 if (newDict[i]["XHSJJ"].ToString() == (newDict[i]["HSJJ"] ?? "").ToString()) { Alert.Show("商品【" + newDict[i]["GDSEQ"] + "】原价格与调整价格相同,请检查!", "异常信息", MessageBoxIcon.Warning); return; } } else { Alert.Show("请维护商品【" + newDict[i]["GDSEQ"] + "】修改后价格!", "异常信息", MessageBoxIcon.Warning); return; } goodsData.Add(newDict[i]); } } if (goodsData.Count == 0)//所有Gird行都为空行时 { Alert.Show("商品信息异常,请详细检查商品信息!", "消息提示", MessageBoxIcon.Warning); return; } if (PubFunc.StrIsEmpty(hfdSEQNO.Text)) { hfdSEQNO.Text = BillSeqGet(); docBILLNO.Text = hfdSEQNO.Text; docBILLNO.Enabled = false; } else { if (hfdSEQNO.Text.Length > 16 || docBILLNO.Text.Length > 16) { Alert.Show("单据编号长度不能大于16,请检查!", "消息提示", MessageBoxIcon.Warning); return; } string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'M') FROM DAT_TJ_DOC WHERE SEQNO='{0}'", docBILLNO.Text)); if (!PubFunc.StrIsEmpty(flg) && (",M,R").IndexOf(flg) < 0) { Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning); return; } else { docBILLNO.Text = hfdSEQNO.Text; docBILLNO.Enabled = false; } } MyTable mtType = new MyTable("DAT_TJ_DOC"); mtType.ColRow = PubFunc.FormDataHT(FormPrice); mtType.ColRow["FLAG"] = "M";//所有单据在保存时单据状态一律为新增M mtType.ColRow.Add("BILLTYPE", BillType); mtType.ColRow.Add("SUBNUM", goodsData.Count); List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtTypeMx = new MyTable("DAT_TJ_COM"); //先删除单据信息在插入 cmdList.Add(new CommandInfo("DELETE DAT_TJ_DOC WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据台头 cmdList.Add(new CommandInfo("DELETE DAT_TJ_COM WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据明细 cmdList.AddRange(mtType.InsertCommand()); for (int i = 0; i < goodsData.Count; i++) { mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]); mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text); mtTypeMx.ColRow["ROWNO"] = i + 1; mtTypeMx.ColRow.Remove("UNITNAME"); mtTypeMx.ColRow.Remove("PRODUCERNAME"); cmdList.Add(mtTypeMx.Insert()); } if (DbHelperOra.ExecuteSqlTran(cmdList)) { btnSubmit.Enabled = true; Alert.Show("商品价格修改信息保存成功!", "消息提示", MessageBoxIcon.Information); OperLog("商品调价", "修改单据【" + docBILLNO.Text + "】"); billOpen(docBILLNO.Text); } else { Alert.Show("商品价格修改信息保存失败,请联系管理员!", "消息提示", MessageBoxIcon.Error); } }
private void save(string flag = "N") { #region 数据有效性验证 if ((",M,R").IndexOf(docFLAG.SelectedValue) < 0) { Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning); return; } List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList(); if (newDict.Count == 0) { Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning); return; } if (PubFunc.FormDataCheck(FormDoc).Length > 0) { return; } List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >(); List <string> newstr = new List <string>(); //判断是否有空行、批号填写是否符合要求 for (int i = 0; i < newDict.Count; i++) { if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString())) { if ((newDict[i]["BZSL"] ?? "").ToString() == "" || (newDict[i]["BZSL"] ?? "").ToString() == "0") { Alert.Show("请填写商品[" + newDict[i]["GDSEQ"] + "]出库数!", "消息提示", MessageBoxIcon.Warning); return; } if (string.IsNullOrWhiteSpace(newDict[i]["BZHL"].ToString()) || string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString())) { Alert.Show("商品[" + newDict[i]["GDSEQ"] + "]包装单位信息错误,请联系管理员维护!", "消息提示", MessageBoxIcon.Warning); return; } if (string.IsNullOrWhiteSpace(newDict[i]["HSJJ"].ToString())) { Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】含税进价不能为空!!!", "消息提示", MessageBoxIcon.Warning); return; } if (string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString())) { Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】出库包装未维护!!!", "消息提示", MessageBoxIcon.Warning); return; } goodsData.Add(newDict[i]); newstr.Add(newDict[i]["STR2"].ToString()); } } if (goodsData.Count == 0)//所有Gird行都为空行时 { Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning); return; } if (newDict.Count != newstr.Distinct().ToArray().Count()) { List <string> strReturn = new List <string>(); StringBuilder sb = new StringBuilder(); int i = 0; foreach (string values in newstr.ToList()) { foreach (string values2 in newstr.ToList()) { if (values2.Equals(values)) { i++; } if (i > 1) { strReturn.Add(values); i = 0; break; } } } foreach (string res in strReturn.Distinct()) { sb.Append(res).Append(","); } Alert.Show(sb.ToString().Substring(0, sb.ToString().Count() - 1) + "高值码重复录入!", "消息提示", MessageBoxIcon.Warning); return; } #endregion if (PubFunc.StrIsEmpty(docBILLNO.Text)) { docSEQNO.Text = BillSeqGet(); docBILLNO.Text = docSEQNO.Text; docBILLNO.Enabled = false; } else { string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_CK_DOC WHERE SEQNO='{0}'", docBILLNO.Text)); if (!string.IsNullOrWhiteSpace(flg) && (",M,R").IndexOf(flg) < 0) { Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning); return; } else { docSEQNO.Text = docBILLNO.Text; docBILLNO.Enabled = false; } } MyTable mtType = new MyTable("DAT_CK_DOC"); mtType.ColRow = PubFunc.FormDataHT(FormDoc); mtType.ColRow["SEQNO"] = docBILLNO.Text; mtType.ColRow.Add("BILLTYPE", BillType); mtType.ColRow.Add("SUBNUM", goodsData.Count); mtType.ColRow.Add("XSTYPE", "G"); List <CommandInfo> cmdList = new List <CommandInfo>(); MyTable mtTypeMx = new MyTable("DAT_CK_COM"); decimal subNum = 0;//总金额 string onecode = string.Empty; //先删除单据信息在插入 cmdList.Add(new CommandInfo("delete DAT_CK_DOC where seqno='" + docBILLNO.Text + "' and flag = 'M'", null)); //删除单据台头 cmdList.Add(new CommandInfo("delete DAT_CK_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细 for (int i = 0; i < goodsData.Count; i++) { mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]); //判断含税进价,为0时不能保存 if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["HSJJ"].ToString()) || mtTypeMx.ColRow["HSJJ"].ToString() == "0") { Alert.Show("商品【含税进价】为0或空,无法进行【库房出库管理】操作。"); return; } mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text); mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]); mtTypeMx.ColRow["DHSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()); mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()); mtTypeMx.ColRow["ROWNO"] = i + 1; subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString()); mtTypeMx.ColRow.Add("XSSL", mtTypeMx.ColRow["DHSL"].ToString()); mtTypeMx.ColRow.Add("BHSJJ", 0); mtTypeMx.ColRow.Add("BHSJE", 0); onecode += mtTypeMx.ColRow["STR2"].ToString() + ","; mtTypeMx.ColRow.Remove("UNITNAME"); mtTypeMx.ColRow.Remove("PRODUCERNAME"); cmdList.Add(mtTypeMx.Insert()); } mtType.ColRow.Add("SUBSUM", subNum); //object objCount = DbHelperOra.GetSingle(@"SELECT LISTAGG(ONECODE,',') WITHIN GROUP( ORDER BY ONECODE) // FROM DAT_CK_EXT WHERE BILLNO <> '" + docBILLNO.Text + @"' // AND ONECODE IN ('" + onecode.Trim(',').Replace(",", "','") + "')"); //if (objCount != null && objCount.ToString().Length > 0) //{ // Alert.Show("高值码【" + objCount.ToString() + "】重复!!!", "异常提醒", MessageBoxIcon.Warning); // return; //} //写入追溯码表 //cmdList.Add(new CommandInfo("DELETE FROM DAT_CK_EXT WHERE BILLNO='" + docBILLNO.Text + "'", null));//删除单据明细 //cmdList.Add(new CommandInfo(String.Format(@"INSERT INTO DAT_CK_EXT(DEPTID,BILLNO,ROWNO,ONECODE,GDSEQ,GDNAME,BARCODE,UNIT,GDSPEC,DEPTCUR,BZHL,FLAG,PH,RQ_SC,YXQZ) // SELECT '{1}','{0}',ROWNUM,A.ONECODE,A.GDSEQ,A.GDNAME,A.BARCODE,A.UNIT,A.GDSPEC,A.DEPTCUR,A.BZHL,A.FLAG,A.PH,A.RQ_SC,A.YXQZ // FROM DAT_RK_EXT A,DAT_CK_COM B // WHERE A.GDSEQ = B.GDSEQ AND B.SEQNO = '{0}' AND (A.ONECODE = B.STR2 OR A.STR1 = B.STR2)", docBILLNO.Text, docDEPTID.SelectedValue), null));//删除单据明细 cmdList.Add(mtType.Insert()); if (DbHelperOra.ExecuteSqlTran(cmdList)) { if (flag == "N") { Alert.Show("商品出库信息保存成功!"); } billLockDoc(true); OperLog("高值扫码出库", "修改单据【" + docBILLNO.Text.Trim() + "】"); billOpen(docBILLNO.Text); hdfRowIndex.Text = ""; } SaveSuccess = true; }