public JsonResult SaveProductRefLabel(string productNo, string ids, string pids) { //productNo = "0100620"; //ids = "a,b,c,d,c#e,f,g,t,y"; //pids = "z,x,c,v"; string msg = ""; try { if (string.IsNullOrEmpty(productNo)) { msg = "没有关联商品"; } else { productLabelService.DeleteProductLabel(productNo);//删除商品关联标签数据 if (ids.Length > 0) { string[] idStrArr = ids.Split('#'); string[] pidAtrr = pids.Split(','); for (int i = 0; i < idStrArr.Length; i++) { if (idStrArr[i].Length == 0) { continue; } string[] idsArr = idStrArr[i].Split(','); for (int j = 0; j < idsArr.Length; j++) { SWfsProductRefLabel reflabel = new SWfsProductRefLabel { ProductNo = productNo, Weight = short.Parse(j.ToString()), RefLabelNo = idsArr[j], RefLabelParentNo = pidAtrr[i] }; productLabelService.InsertProductLabel(reflabel); } } } msg = "保存成功"; } } catch (Exception) { return(Json(new { msg = "保存商标关联标签时出现异常,请稍后再试!", data = "0" }, JsonRequestBehavior.AllowGet)); } return(Json(new { msg = msg, data = "1" }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 插入商标关联标签 /// </summary> /// <param name="sWfsProductRefLabel"></param> /// <returns></returns> public int InsertProductLabel(SWfsProductRefLabel sWfsProductRefLabel) { return(DapperUtil.Insert <SWfsProductRefLabel>(sWfsProductRefLabel, true)); }