protected void BtnSave_Click(object sender, EventArgs e) { userManager theUserManager = (userManager)Session["theUserManager"]; string userName = theUserManager.getUserName(); //已经上线的计划需要走流程确认 if (PubLogic.isEngOnline(LabPlanCode.Text, LabSO.Text, LabOldPart.Text, LabNewPart.Text, LabLocation.Text, LabPlineCode.Text)) { Response.Write("<script>alert('计划已上线,将提交给调度确认.');</script>"); BomReplaceFactory.MW_MODIFY_SJBOMTHCFM("ADD", LabPlanCode.Text, LabSO.Text, LabOldPart.Text, LabNewPart.Text, userName, LabLocation.Text, LabPlineCode.Text); } else { string sql = "select nvl(item_flag,'N') from data_plan where plan_code='" + LabPlanCode.Text + "' "; if (dc.GetValue(sql) == "Y") { Response.Write("<script>alert('计划已库房确认,不能替换!');</script>"); return; } //判断是否指定供应商 if (PubLogic.isZdgys(LabPlanCode.Text, LabSO.Text, LabOldPart.Text, LabPlineCode.Text)) { Response.Write("<script>alert('已经指定供应商,不能替换!');</script>"); } else { BomReplaceFactory.PL_INSERT_SJBOMSOTH("ADD", LabSO.Text, LabOldPart.Text, LabNewPart.Text, "", "", "", userName, Request.UserHostAddress, LabPlanCode.Text, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), LabLocation.Text, LabNum.Text, "", "0", LabPlineCode.Text); Response.Write("<script>alert('替换成功');</script>"); } } }
protected void gridMaterial_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e) { string oldPart = gridMaterial.GetRowValues(e.VisibleIndex, "ITEM_CODE").ToString(); string newPart = gridMaterial.GetRowValues(e.VisibleIndex, "NEWPART").ToString(); string locationCode = gridMaterial.GetRowValues(e.VisibleIndex, "LOCATION_CODE").ToString(); string itemQty = gridMaterial.GetRowValues(e.VisibleIndex, "ITEM_QTY").ToString(); string planCode = Session["planCode"].ToString(); string so = Session["so"].ToString(); string plineCode = cmbPline.Value.ToString(); gridMaterial.JSProperties.Add("cpCallbackName", e.ButtonID.ToString()); //一对一替换 if (e.ButtonID == "OneReplace") { userManager theUserManager = (userManager)Session["theUserManager"]; string userName = theUserManager.getUserName(); ////已经上线的计划需要走流程确认 //if (PubLogic.isEngOnline(planCode, so, oldPart, newPart, locationCode, plineCode)) //{ // gridMaterial.JSProperties.Add("cpAlertContent", "计划已上线,将提交给调度确认."); // BomReplaceFactory.MW_MODIFY_SJBOMTHCFM("ADD", planCode, so, oldPart, newPart, // userName, locationCode, plineCode); //} //else { //string sql = "select nvl(item_flag,'N') from data_plan where plan_code='" + planCode + "' "; //if (dc.GetValue(sql) == "Y") //{ // gridMaterial.JSProperties.Add("cpAlertContent", "计划已库房确认,不能替换!"); // return; //} string sql = "select nvl(third_flag,'N') from data_plan where plan_code='" + planCode + "' "; if (dc.GetValue(sql) == "P") { gridMaterial.JSProperties.Add("cpAlertContent", "计划正参与三方计算,不能替换!"); return; } //判断是否指定供应商 if (PubLogic.isZdgys(planCode, so, oldPart, cmbPline.Value.ToString())) { gridMaterial.JSProperties.Add("cpAlertContent", "已经指定供应商,不能替换!"); return; } BomReplaceFactory.PL_INSERT_SJBOMSOTH("ADD", so, oldPart, newPart, "", "", "", userName, Request.UserHostAddress, planCode, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), locationCode, itemQty, "", "0", plineCode); //gridMaterial.JSProperties.Add("cpAlertContent", "替换成功"); } gridMaterial.DataSource = dc.GetTable(Session["gridMaterial"].ToString()); gridMaterial.DataBind(); } //多对多替换 if (e.ButtonID == "MultiReplace") { gridMaterial.JSProperties.Add("cpplineCode", plineCode); gridMaterial.JSProperties.Add("cpplanCode", planCode); gridMaterial.JSProperties.Add("cpso", so); gridMaterial.JSProperties.Add("cpitemCode", oldPart); gridMaterial.JSProperties.Add("cpnewPart", newPart); gridMaterial.JSProperties.Add("cplocationCode", locationCode); gridMaterial.JSProperties.Add("cpitemQty", itemQty); } }