Fix 生产进度双击报错

This commit is contained in:
Ling 2024-05-22 17:15:17 +08:00
parent dff441d0a0
commit ed8787f231
2 changed files with 31 additions and 27 deletions

View File

@ -163,12 +163,13 @@ public partial class Productout_browse : System.Web.UI.Page
DataTable dt = DBHlper.Execute(string.Format("select * from nr_z_cpkc where scdh='{0}' and xmmc='{1}' and khmc='{2}'", scdh.Text, cpbh.Text, khming.Text)).Tables[0]; DataTable dt = DBHlper.Execute(string.Format("select * from nr_z_cpkc where scdh='{0}' and xmmc='{1}' and khmc='{2}'", scdh.Text, cpbh.Text, khming.Text)).Tables[0];
double sl = Convert.ToDouble(dt.Rows[0]["sl"]); double sl = Convert.ToDouble(dt.Rows[0]["sl"]);
double nowsl = Convert.ToDouble(shuliang.Text); double nowsl = Convert.ToDouble(shuliang.Text);
int gxcount= DBHlper.excutecmd("update nr_z_cpkc set sl=" + (sl + nowsl) + " where id=" + dt.Rows[0]["id"]); int gxcount = DBHlper.excutecmd("update nr_z_cpkc set sl=" + (sl + nowsl) + " where id=" + dt.Rows[0]["id"]);
if (gxcount > 0) if (gxcount > 0)
{ {
DBHlper.excutecmd("update nr_z_cpck set zt='待确认' where id=" + id.Value); DBHlper.excutecmd("update nr_z_cpck set zt='待确认' where id=" + id.Value);
} }
else { else
{
Response.Write("<script>alert('出库冲红失败')</script>"); Response.Write("<script>alert('出库冲红失败')</script>");
} }
@ -178,7 +179,7 @@ public partial class Productout_browse : System.Web.UI.Page
//将session转换对象取值 //将session转换对象取值
Maticsoft.Model.nr_z_yhzh zh = (Maticsoft.Model.nr_z_yhzh)Session["user"]; Maticsoft.Model.nr_z_yhzh zh = (Maticsoft.Model.nr_z_yhzh)Session["user"];
//拼接字符串插入日志 //拼接字符串插入日志
rizhi.jilu = zh.zhanghao + "执行了出库冲红,出库单号为:" +ckdh.Text.Trim(); rizhi.jilu = zh.zhanghao + "执行了出库冲红,出库单号为:" + ckdh.Text.Trim();
rizhi.yonghuming = zh.zhanghao.ToString(); rizhi.yonghuming = zh.zhanghao.ToString();
rizhibll.Add(rizhi); rizhibll.Add(rizhi);
Response.Redirect("Productout_browse.aspx?uid=" + id.Value); Response.Redirect("Productout_browse.aspx?uid=" + id.Value);
@ -187,7 +188,8 @@ public partial class Productout_browse : System.Web.UI.Page
protected void btn_chuku_Click(object sender, EventArgs e) protected void btn_chuku_Click(object sender, EventArgs e)
{ {
DataTable dt = DBHlper.Execute(string.Format("select * from view_nr_z_cpkc where scdh='{0}' and xmmc='{1}' and khmc='{2}'", scdh.Text, cpbh.Text, khming.Text)).Tables[0]; var result = DBHlper.Execute(string.Format("select * from view_nr_z_cpkc where scdh='{0}' and xmmc='{1}' and khmc='{2}'", scdh.Text, cpbh.Text, khming.Text));
DataTable dt = result.Tables[0];
if (dt.Rows.Count == 0) if (dt.Rows.Count == 0)
{ {
Response.Write("<script>alert('库存不足')</script>"); Response.Write("<script>alert('库存不足')</script>");

View File

@ -61,7 +61,7 @@ public partial class Schedule_list : CommonPage
wherecode += "id"; wherecode += "id";
if (DBHlper.GetPermission(zhanghao.juese, "生产进度", "view_nr_z_scjd", "查看全部")) if (DBHlper.GetPermission(zhanghao.juese, "生产进度", "view_nr_z_scjd", "查看全部"))
{ {
wherecode += string.Format(" from view_nr_z_scjd where " + tiaojian + " id not in(select top ({0}*{1}) id from view_nr_z_scjd "+" where "+tiaojian+" 1=1 " + paixu + ")" + paixu, pg, pageitem); wherecode += string.Format(" from view_nr_z_scjd where " + tiaojian + " id not in(select top ({0}*{1}) id from view_nr_z_scjd " + " where " + tiaojian + " 1=1 " + paixu + ")" + paixu, pg, pageitem);
} }
DataTable dt_paixu = DBHlper.Execute(wherecode).Tables[0]; DataTable dt_paixu = DBHlper.Execute(wherecode).Tables[0];
@ -72,7 +72,7 @@ public partial class Schedule_list : CommonPage
for (int i = 0; i < dt_paixu.Rows.Count; i++) for (int i = 0; i < dt_paixu.Rows.Count; i++)
{ {
htmlcode += "<tr tag='" + dt_paixu.Rows[i]["id"] + "' >"; htmlcode += "<tr tagData='" + dt_paixu.Rows[i]["id"] + "' >";
htmlcode += " <td style='width:20px'><input type='checkbox' class='xz'/></td>"; htmlcode += " <td style='width:20px'><input type='checkbox' class='xz'/></td>";
for (int j = 0; j < dt_paixu.Columns.Count - 1; j++) for (int j = 0; j < dt_paixu.Columns.Count - 1; j++)
{ {
@ -97,7 +97,7 @@ public partial class Schedule_list : CommonPage
int dxfzsl = Convert.ToInt32(djzsl) - Convert.ToInt32(yxfzsl); int dxfzsl = Convert.ToInt32(djzsl) - Convert.ToInt32(yxfzsl);
//滞留总数量 //滞留总数量
int zlzsl = ddjzsl + dxfzsl; int zlzsl = ddjzsl + dxfzsl;
if ( Convert.ToInt32(ybfzsl)>10) if (Convert.ToInt32(ybfzsl) > 10)
{ {
htmlcode += "<td class='progress-bar ret'><span><ul style='margin-top:3px; margin-bottom:3px; color:#ffffff'><li>需产:" + xcsl + "</li><li>滞留:" + zlzsl + "</li><li>下发:" + yxfzsl + "</li><li>报废:" + ybfzsl + "</li><ul></span></td>"; htmlcode += "<td class='progress-bar ret'><span><ul style='margin-top:3px; margin-bottom:3px; color:#ffffff'><li>需产:" + xcsl + "</li><li>滞留:" + zlzsl + "</li><li>下发:" + yxfzsl + "</li><li>报废:" + ybfzsl + "</li><ul></span></td>";
} }
@ -105,7 +105,7 @@ public partial class Schedule_list : CommonPage
{ {
htmlcode += "<td class='progress-bar blue'><span><ul style='margin-top:3px; margin-bottom:3px; color:#ffffff'><li>需产:" + xcsl + "</li><li>滞留:" + zlzsl + "</li><li>下发:" + yxfzsl + "</li><li>报废:" + ybfzsl + "</li><ul></span></td>"; htmlcode += "<td class='progress-bar blue'><span><ul style='margin-top:3px; margin-bottom:3px; color:#ffffff'><li>需产:" + xcsl + "</li><li>滞留:" + zlzsl + "</li><li>下发:" + yxfzsl + "</li><li>报废:" + ybfzsl + "</li><ul></span></td>";
} }
else if (Convert.ToInt32(xcsl)> 0 && zlzsl<=0) else if (Convert.ToInt32(xcsl) > 0 && zlzsl <= 0)
{ {
htmlcode += "<td class='progress-bar green'><span><ul style='margin-top:3px; margin-bottom:3px; color:#ffffff'><li>需产:" + xcsl + "</li><li>滞留:" + zlzsl + "</li><li>下发:" + yxfzsl + "</li><li>报废:" + ybfzsl + "</li><ul></span></td>"; htmlcode += "<td class='progress-bar green'><span><ul style='margin-top:3px; margin-bottom:3px; color:#ffffff'><li>需产:" + xcsl + "</li><li>滞留:" + zlzsl + "</li><li>下发:" + yxfzsl + "</li><li>报废:" + ybfzsl + "</li><ul></span></td>";
@ -281,19 +281,20 @@ public partial class Schedule_list : CommonPage
#region #region
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)] [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
public string nowdaycount(string zt,int selmonth) public string nowdaycount(string zt, int selmonth)
{ {
DateTime nowdt = DateTime.Now; DateTime nowdt = DateTime.Now;
int days = DateTime.DaysInMonth(nowdt.Year, selmonth); int days = DateTime.DaysInMonth(nowdt.Year, selmonth);
string yuechu = nowdt.Year + "-" + selmonth + "-" + "1"; string yuechu = nowdt.Year + "-" + selmonth + "-" + "1";
string yuemo = Convert.ToDateTime(nowdt.Year + "-" + selmonth + "-" +days).AddDays(1).ToString("yyyy-MM-dd"); string yuemo = Convert.ToDateTime(nowdt.Year + "-" + selmonth + "-" + days).AddDays(1).ToString("yyyy-MM-dd");
DateTime yc = Convert.ToDateTime(yuechu); DateTime yc = Convert.ToDateTime(yuechu);
string cmd = ""; string cmd = "";
if (zt == "") if (zt == "")
{ {
cmd = string.Format("select CONVERT(varchar(12),riqi,111) as 'riqi' from view_nr_z_scjd where riqi>='{0}' and riqi<='{1}' ", yuechu, yuemo); cmd = string.Format("select CONVERT(varchar(12),riqi,111) as 'riqi' from view_nr_z_scjd where riqi>='{0}' and riqi<='{1}' ", yuechu, yuemo);
} }
else { else
{
cmd = string.Format("select CONVERT(varchar(12),riqi,111) as 'riqi' from view_nr_z_scjd where riqi>='{0}' and riqi<='{1}' and zt='{2}' ", yuechu, yuemo, zt); cmd = string.Format("select CONVERT(varchar(12),riqi,111) as 'riqi' from view_nr_z_scjd where riqi>='{0}' and riqi<='{1}' and zt='{2}' ", yuechu, yuemo, zt);
} }
@ -388,7 +389,8 @@ public partial class Schedule_list : CommonPage
{ {
selectcode = "select " + colmn + " from view_nr_z_scjd where zt='" + drp_zt.Text + "'"; selectcode = "select " + colmn + " from view_nr_z_scjd where zt='" + drp_zt.Text + "'";
} }
else { else
{
selectcode = "select " + colmn + " from view_nr_z_scjd where 1=1 "; selectcode = "select " + colmn + " from view_nr_z_scjd where 1=1 ";
} }
@ -400,8 +402,8 @@ public partial class Schedule_list : CommonPage
{ {
selectcode += " and id in(" + selectid.TrimEnd(',') + ")"; selectcode += " and id in(" + selectid.TrimEnd(',') + ")";
} }
DataTable dt = DBHlper.Execute(selectcode+" order by id desc").Tables[0]; DataTable dt = DBHlper.Execute(selectcode + " order by id desc").Tables[0];
DBHlper.ExportByWeb(dt, "生产单"+DateTime.Now, sList); DBHlper.ExportByWeb(dt, "生产单" + DateTime.Now, sList);
} }
#endregion #endregion