public bool AddMatirialModel(Goods goods) { GoodsModel model = new GoodsModel(); Goods_ClassModel classModel = bllGoodsClass.GetModelByClassName(goods.MaterialType); model.Goods_Class_ID = classModel.Goods_Class_ID; model.Goods_Code = goods.MaterialCode; model.Goods_Flag = goods.MaterialFlag; model.Goods_Name = goods.MaterialName; model.Goods_Unit = goods.MaterialUnit; model.Goods_ID = Guid.NewGuid().ToString(); model.Goods_Category = goods.MaterialType; model.Goods_Model = goods.MaterialModel; return(bllGoods.Add(model)); }
public ActionResult AfterCreate(Goods goods) { if (goods != null) { var temp = GoodsBll.Add(goods); if (temp == true) { return(Content("ok:成功")); } else { return(Content("no: 失败")); } } ViewBag.goodstype = new SelectList(GoodsTypeBll.GetAll(), "Type_ID", "Type_Name", goods.Type_ID); ViewBag.goodsborder = new SelectList(BorderBll.GetAll(), "Border_ID", "Border_Name", goods.Border_ID); return(View(goods)); }
/// <summary> /// 确定提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { model = GetModel(); if (_Pid != "SysError") { if (bll.Update(model)) { this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>"); } } else { if (bll.Add(model) != null) { JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString()); } } }
protected void btnSave_Click(object sender, EventArgs e) { int updateInt = -1; if (this.id == "") { if (this.FileUpload1.HasFile == false) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('请选择任务图片');</script>"); return; } GoodsModel mod = new GoodsModel(); mod.GoodsId = IdCreator.CreateId("T_Goods_Info", "GoodsId"); mod.AddTime = DateTime.Now; if (hfSign.Value.Length > 0) { mod.signId = hfSign.Value; } else { mod.signId = ""; } string fileExt = System.IO.Path.GetExtension(this.FileUpload1.FileName).ToLower(); if (fileExt != ".jpeg" && fileExt != ".jpg" && fileExt != ".png" && fileExt != ".bmp" && fileExt != ".gif") { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片格式不正确');</script>"); return; } if (this.FileUpload1.PostedFile.ContentLength > 1024000) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片不能大于1M');</script>"); return; } string newFileName = Guid.NewGuid().ToString() + fileExt; string dir = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (System.IO.Directory.Exists(Server.MapPath(dir)) == false) { System.IO.Directory.CreateDirectory(Server.MapPath(dir)); } string newPath = dir + newFileName; this.FileUpload1.SaveAs(Server.MapPath(newPath)); //缩略图 MakeSmallPic(Server.MapPath(newPath), Server.MapPath(newPath.Replace(fileExt, "_s" + fileExt))); mod.GoodsSmallPic = newPath.Replace(fileExt, "_s" + fileExt); //mod.GoodsSmallPic = newPath.Replace(fileExt, "" + fileExt); ViewState["OriginalBigImg"] = mod.GoodsSmallPic; GetFormInfo(ref mod); if (mod.CategoryId == "1") { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('未选择分类')</script>"); } if (bll.Add(mod) > 0) { string strShop = "select shopId from T_Shop_User where isdefault=1;"; DataSet ds = StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance).ExecuteSqlDataset(strShop); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string newGuid = Guid.NewGuid().ToString(); string shopId = ds.Tables[0].Rows[0][0].ToString(); string goodsId = mod.GoodsId; int num = mod.Sotck.Value; decimal price = mod.SalePrice.Value; int isSell = mod.IsSale.Value; DateTime addt = DateTime.Now; string goodsCode = mod.GoodsCode; string strGoods = "insert into T_Shop_Goods values('" + newGuid + "','" + shopId + "','" + goodsId + "'," + num + "," + price + "," + isSell + ",'" + addt + "','" + goodsCode + "',0,0,0,0);"; StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance).ExecuteSqlNonQuery(strGoods); } } string strItem = "insert T_Menu_Item(itemName,itemImgSrc,ifBuy,GoodsId,orderBy,remark,unit) values(@itemName,@itemImgSrc,@ifBuy,@GoodsId,@orderBy,@remark,@unit);"; SqlParameter[] q = { // @itemImgSrc,@ifBuy,@GoodsId,@orderBy,@remark,@unit new SqlParameter("@itemName", SqlDbType.VarChar), new SqlParameter("@itemImgSrc", SqlDbType.VarChar), new SqlParameter("@ifBuy", SqlDbType.Int), new SqlParameter("@GoodsId", SqlDbType.VarChar), new SqlParameter("@orderBy", SqlDbType.Int), new SqlParameter("@remark", SqlDbType.VarChar), new SqlParameter("@unit", SqlDbType.VarChar) }; q[0].Value = mod.GoodsName; q[1].Value = mod.GoodsSmallPic; q[2].Value = 1; q[3].Value = mod.GoodsId; q[4].Value = 9999; q[5].Value = "任务“" + mod.GoodsName + "”添加"; q[6].Value = mod.Uint; int rows = StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance).ExecuteSqlNonQuery(strItem, q); //默认幻灯图片 //if (ViewState["OriginalBigImg"] != null) { AddDefaultPic(mod.GoodsId, ViewState["OriginalBigImg"].ToString()); } LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "添加课程《" + mod.GoodsName + "》", "添加", "", "", HttpContext.Current.Request.Url.ToString()); ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>if(confirm('保存成功')){location.href='GoodsAdd.aspx?id=" + mod.GoodsId + "'}else{}</script>"); } } else { updateInt = 0; //string strSQL = "select * from T_Goods_Update where goodsid='" + id+"' and updatetime>'"+DateTime.Now.ToShortDateString()+" 00:00:00';"; string strSQL = ""; AdoHelper adohelper = StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance); //DataSet ds = adohelper.ExecuteSqlDataset(strSQL); //if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count >= 0) //{ // if (ds.Tables[0].Rows.Count > 2) // { // ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('编辑成功');</script>"); // return; // } // else // { // updateInt = 2 - ds.Tables[0].Rows.Count; // } //} GoodsModel mod = bll.GetModel(this.id); if (this.FileUpload1.HasFile == true) { string fileExt = System.IO.Path.GetExtension(this.FileUpload1.FileName).ToLower(); if (fileExt != ".jpeg" && fileExt != ".jpg" && fileExt != ".png" && fileExt != ".bmp" && fileExt != ".gif") { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片格式不正确');</script>"); return; } if (this.FileUpload1.PostedFile.ContentLength > 10240000) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片不能大于10M');</script>"); return; } string newFileName = Guid.NewGuid().ToString() + fileExt; string dir = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (System.IO.Directory.Exists(Server.MapPath(dir)) == false) { System.IO.Directory.CreateDirectory(Server.MapPath(dir)); } string newPath = dir + newFileName; this.FileUpload1.SaveAs(Server.MapPath(newPath)); //缩略图 MakeSmallPic(Server.MapPath(newPath), Server.MapPath(newPath.Replace(fileExt, "_s" + fileExt))); mod.GoodsSmallPic = newPath.Replace(fileExt, "_s" + fileExt); //mod.GoodsSmallPic = newPath.Replace(fileExt, "" + fileExt); ViewState["OriginalBigImg"] = mod.GoodsSmallPic; } //hfSign.Value = hfSign.Value.Replace("--", "-"); if (hfSign.Value.Length > 0) { mod.signId = hfSign.Value; } else { mod.signId = ""; } GetFormInfo(ref mod); if (bll.Update(mod)) { adohelper.ExecuteSqlNonQuery("update T_Goods_Info set JobDay=datediff(day,JobStartTime,JobEndTime) where GoodsId='" + mod.GoodsId + "'"); //默认图片 //if (ViewState["OriginalBigImg"] != null) { AddDefaultPic(mod.GoodsId, ViewState["OriginalBigImg"].ToString()); } //if (updateInt == -1) // ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('保存成功');location.href='GoodsList.aspx?id=" + this.cselect.categoryID + "';</script>"); //else{ strSQL = "insert T_Goods_Update values('" + mod.GoodsId + "',getdate(),'');"; adohelper.ExecuteSqlNonQuery(strSQL); LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "编辑任务《" + mod.GoodsName + "》", "编辑", "", "", HttpContext.Current.Request.Url.ToString()); ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('编辑成功');</script>"); //} } } }
/// <summary> /// 基础物料数据信息 /// </summary> /// <param name="materialInfoJson">物料信息json串</param> /// <param name="operateType">操作类型:1增加、2更新、3删除</param> /// <returns></returns> public string MaterialInfo(string materialInfoJson, string operateType) { //materialInfoJson = GetMaterialTestJson();//测试 ResponseData response = new ResponseData(); try { MaterialInfo materialInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <MaterialInfo>(materialInfoJson); if (materialInfo == null) { response.Describe = "物料基础数据格式错误!"; response.Status = false; MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson); return(response.ToJson()); } if (materialInfo.material_class == "" || materialInfo.material_class == null) { response.Describe = "物料基础数据的物料大类为空!"; response.Status = false; MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson); return(response.ToJson()); } Goods_ClassModel gsClassModel = bllGoods_Class.GetModelByClassName(materialInfo.material_class);//物料大类型 if (gsClassModel == null) { gsClassModel = new Goods_ClassModel(); gsClassModel.Goods_Class_Name = materialInfo.material_class; string gsClassMainID = Guid.NewGuid().ToString(); gsClassModel.Goods_Class_ID = gsClassMainID; gsClassModel.Goods_Class_Flag = "true"; bllGoods_Class.Add(gsClassModel); } else { gsClassModel.Goods_Class_Name = materialInfo.material_class; gsClassModel.Goods_Class_Flag = "true"; bllGoods_Class.Update(gsClassModel); } if (operateType != "1" && operateType != "2" && operateType != "3") { response.Describe = "接口操作标识错误!operateType,1为增加,2为更新,3为删除!"; response.Status = false; MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson); return(response.ToJson()); } switch (operateType) { case "1": //增加 { GoodsModel existgoods = bllGoods.GetModelByCode(materialInfo.material_code); if (existgoods != null) { response.Describe = "物料基础数据添加失败,已经存在此物料编码:" + materialInfo.material_code; response.Status = false; MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson); return(response.ToJson()); } GoodsModel goods = new GoodsModel(); goods.Goods_ID = Guid.NewGuid().ToString(); goods.Goods_Code = materialInfo.material_code; goods.Goods_Class_ID = gsClassModel.Goods_Class_ID; goods.Goods_Suppier_Code = materialInfo.material_supplier_code; goods.Goods_Category = materialInfo.material_category; goods.Goods_Name = materialInfo.material_name; if (materialInfo.material_enabled == true) { goods.Goods_Flag = "1"; } else { goods.Goods_Flag = "0"; } goods.Goods_Type = materialInfo.material_category; goods.Goods_Unit = materialInfo.material_unit; goods.Goods_Model = materialInfo.material_model; bllGoods.Add(goods); GoodsPropertyOperate(goods.Goods_ID, "shelflife", "保质期", materialInfo.material_shelflife.ToString(), true); //保质期 break; } case "2": //更新 { GoodsModel goods = bllGoods.GetModelByCode(materialInfo.material_code); if (goods == null) { response.Describe = "物料基础数据更新失败,不存此物料编码:" + materialInfo.material_code; response.Status = false; MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson); return(response.ToJson()); } goods.Goods_Code = materialInfo.material_code; goods.Goods_Class_ID = gsClassModel.Goods_Class_ID; goods.Goods_Suppier_Code = materialInfo.material_supplier_code; goods.Goods_Name = materialInfo.material_name; if (materialInfo.material_enabled == true) { goods.Goods_Flag = "1"; } else { goods.Goods_Flag = "0"; } goods.Goods_Type = materialInfo.material_category; goods.Goods_Unit = materialInfo.material_unit; goods.Goods_Model = materialInfo.material_model; bllGoods.Update(goods); GoodsPropertyOperate(goods.Goods_ID, "shelflife", "保质期", materialInfo.material_shelflife.ToString(), false); //保质期 break; } case "3": { bllGoods.DeleteByCode(materialInfo.material_code); bllGoodsProperty.DeleteByGoodsCode(materialInfo.material_code); break; } default: { response.Status = false; response.Describe = "操作类型错误,operateType,1为增加,2为更新,3为删除!"; return(response.ToJson()); } } response.Describe = "物料基础数据导入成功!"; response.Status = true; MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson); return(response.ToJson()); } catch (Exception ex) { response.Describe = "物料基础数据导入失败!错误原因:" + ex.StackTrace.ToString(); response.Status = false; MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson); return(response.ToJson()); } }
protected void btnSave_Click(object sender, EventArgs e) { int updateInt = -1; if (this.id == "") { if (this.FileUpload1.HasFile == false) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('请选择任务图片');</script>"); return; } if (this.ddlMorePropertys.SelectedValue == "视频和练习") { if (this.FileUpload2.HasFile == false) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('请选择视频文件');</script>"); return; } } GoodsModel mod = new GoodsModel(); mod.GoodsId = IdCreator.CreateId("T_Goods_Info", "GoodsId"); mod.AddTime = DateTime.Now; mod.CategoryId = mod.GoodsToTypeId = this.hid_pgoodsid.Value; if (hfSign.Value.Length > 0) { mod.signId = hfSign.Value; } else { mod.signId = ""; } string fileExt = System.IO.Path.GetExtension(this.FileUpload1.FileName).ToLower(); if (fileExt != ".jpeg" && fileExt != ".jpg" && fileExt != ".png" && fileExt != ".bmp" && fileExt != ".gif") { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片格式不正确');</script>"); return; } if (this.FileUpload1.PostedFile.ContentLength > 1024000) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片不能大于1M');</script>"); return; } string newFileName = Guid.NewGuid().ToString() + fileExt; string dir = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (System.IO.Directory.Exists(Server.MapPath(dir)) == false) { System.IO.Directory.CreateDirectory(Server.MapPath(dir)); } string newPath = dir + newFileName; this.FileUpload1.SaveAs(Server.MapPath(newPath)); //缩略图 //MakeSmallPic(Server.MapPath(newPath), Server.MapPath(newPath.Replace(fileExt, "_s" + fileExt))); //mod.GoodsSmallPic = newPath.Replace(fileExt, "_s" + fileExt); mod.GoodsSmallPic = newPath; ViewState["OriginalBigImg"] = mod.GoodsSmallPic; //视频文件_start if (this.FileUpload2.HasFile == true) { string fileExt_video = System.IO.Path.GetExtension(this.FileUpload2.FileName).ToLower(); if (fileExt_video != ".mp4") { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('视频格式不正确');</script>"); return; } string newFileName_video = Guid.NewGuid().ToString() + fileExt_video; string dir_video = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (System.IO.Directory.Exists(Server.MapPath(dir_video)) == false) { System.IO.Directory.CreateDirectory(Server.MapPath(dir_video)); } string newPath_video = dir_video + newFileName_video; this.FileUpload2.SaveAs(Server.MapPath(newPath_video)); mod.BookInfo = newPath_video; } //视频文件_end GetFormInfo(ref mod); if (mod.CategoryId == "1") { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('未选择分类')</script>"); } if (bll.Add(mod) > 0) { //默认幻灯图片 //if (ViewState["OriginalBigImg"] != null) { AddDefaultPic(mod.GoodsId, ViewState["OriginalBigImg"].ToString()); } LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "添加任务《" + mod.GoodsName + "》", "添加", "", "", HttpContext.Current.Request.Url.ToString()); ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>if(confirm('保存成功')){location.href='SubGoodsAdd.aspx?id=" + mod.GoodsId + "'}else{}</script>"); } } else { updateInt = 0; //string strSQL = "select * from T_Goods_Update where goodsid='" + id+"' and updatetime>'"+DateTime.Now.ToShortDateString()+" 00:00:00';"; string strSQL = ""; AdoHelper adohelper = StarTech.DBUtility.AdoHelper.CreateHelper(AppConfig.DBInstance); //DataSet ds = adohelper.ExecuteSqlDataset(strSQL); //if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count >= 0) //{ // if (ds.Tables[0].Rows.Count > 2) // { // ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('编辑成功');</script>"); // return; // } // else // { // updateInt = 2 - ds.Tables[0].Rows.Count; // } //} GoodsModel mod = bll.GetModel(this.id); if (this.FileUpload1.HasFile == true) { string fileExt = System.IO.Path.GetExtension(this.FileUpload1.FileName).ToLower(); if (fileExt != ".jpeg" && fileExt != ".jpg" && fileExt != ".png" && fileExt != ".bmp" && fileExt != ".gif") { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片格式不正确');</script>"); return; } if (this.FileUpload1.PostedFile.ContentLength > 1024000) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('图片不能大于1M');</script>"); return; } string newFileName = Guid.NewGuid().ToString() + fileExt; string dir = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (System.IO.Directory.Exists(Server.MapPath(dir)) == false) { System.IO.Directory.CreateDirectory(Server.MapPath(dir)); } string newPath = dir + newFileName; this.FileUpload1.SaveAs(Server.MapPath(newPath)); //缩略图 //MakeSmallPic(Server.MapPath(newPath), Server.MapPath(newPath.Replace(fileExt, "_s" + fileExt))); //mod.GoodsSmallPic = newPath.Replace(fileExt, "_s" + fileExt); mod.GoodsSmallPic = newPath; ViewState["OriginalBigImg"] = mod.GoodsSmallPic; } //视频文件_start if (this.FileUpload2.HasFile == true) { string fileExt_video = System.IO.Path.GetExtension(this.FileUpload2.FileName).ToLower(); if (fileExt_video != ".mp4") { ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('视频格式不正确');</script>"); return; } string newFileName_video = Guid.NewGuid().ToString() + fileExt_video; string dir_video = "/upload/goodsadmin/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (System.IO.Directory.Exists(Server.MapPath(dir_video)) == false) { System.IO.Directory.CreateDirectory(Server.MapPath(dir_video)); } string newPath_video = dir_video + newFileName_video; this.FileUpload2.SaveAs(Server.MapPath(newPath_video)); mod.BookInfo = newPath_video; } //视频文件_end //hfSign.Value = hfSign.Value.Replace("--", "-"); if (hfSign.Value.Length > 0) { mod.signId = hfSign.Value; } else { mod.signId = ""; } GetFormInfo(ref mod); if (bll.Update(mod)) { adohelper.ExecuteSqlNonQuery("update T_Goods_Info set JobDay=datediff(day,JobStartTime,JobEndTime) where GoodsId='" + mod.GoodsId + "'"); //默认图片 //if (ViewState["OriginalBigImg"] != null) { AddDefaultPic(mod.GoodsId, ViewState["OriginalBigImg"].ToString()); } //if (updateInt == -1) // ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('保存成功');location.href='GoodsList.aspx?id=" + this.cselect.categoryID + "';</script>"); //else{ strSQL = "insert T_Goods_Update values('" + mod.GoodsId + "',getdate(),'');"; adohelper.ExecuteSqlNonQuery(strSQL); LogAdd.CreateLog(HttpContext.Current.Session["UserId"].ToString(), "编辑任务《" + mod.GoodsName + "》", "编辑", "", "", HttpContext.Current.Request.Url.ToString()); ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('编辑成功');</script>"); //} } } }
//public bool Login(string userName, string password) //{ // if(this.userName == userName && this.password == password) // { // UserInfor user = new UserInfor(); // user.UserName = userName; // user.PassWord = password; // string sessionID = OperationContext.Current.SessionId; // clientUser.Add(sessionID, user); // return true; // } // else // { // return false; // } //} public ResponseData BasicGoodsInfoImport(BasicGoodsInfo basicGoodsInfo) { ResponseData response = new ResponseData(); try { //if(this.GetSvrEnabled() == false) //{ // return false; //} if (basicGoodsInfo == null) { response.Describe = "物料基础数据对象为空!"; response.Status = false; return(response); } if (basicGoodsInfo.GoodsClass == "" || basicGoodsInfo.GoodsClass == null) { response.Describe = "物料基础数据的物料大类为空!"; response.Status = false; return(response); } Goods_ClassModel gsClassModel = bllGoods_Class.GetModelByClassName(basicGoodsInfo.GoodsClass); if (gsClassModel == null) { gsClassModel = new Goods_ClassModel(); gsClassModel.Goods_Class_Name = basicGoodsInfo.GoodsClass; string gsClassMainID = Guid.NewGuid().ToString(); gsClassModel.Goods_Class_ID = gsClassMainID; gsClassModel.Goods_Class_Flag = "true"; bllGoods_Class.Add(gsClassModel); } else { gsClassModel.Goods_Class_Name = basicGoodsInfo.GoodsClass; gsClassModel.Goods_Class_Flag = "true"; bllGoods_Class.Update(gsClassModel); } GoodsModel goods = bllGoods.GetModelByReserve1(basicGoodsInfo.GoodsInnerCode.ToString()); if (goods == null)//没有就添加否则更新 { goods = new GoodsModel(); goods.Goods_ID = Guid.NewGuid().ToString(); goods.Goods_Code = basicGoodsInfo.GoodsID; goods.Goods_Class_ID = gsClassModel.Goods_Class_ID; goods.Goods_Suppier_Code = basicGoodsInfo.GoodsApplierCode; goods.Goods_Reserve1 = basicGoodsInfo.GoodsInnerCode.ToString(); goods.Goods_Name = basicGoodsInfo.GoodsName; goods.Goods_Flag = basicGoodsInfo.GoodsStatus; goods.Goods_Type = basicGoodsInfo.GoodsType; goods.Goods_Unit = basicGoodsInfo.GoodsUnit; bllGoods.Add(goods); GoodsPropertyOperate(goods.Goods_ID, "fzxx", basicGoodsInfo.GoodsAssistProperty, true); //辅助信息 GoodsPropertyOperate(goods.Goods_ID, "zxbzsl", basicGoodsInfo.GoodsMinPackNum.ToString(), true); //辅助信息 GoodsPropertyOperate(goods.Goods_ID, "wljx", basicGoodsInfo.GoodsPolar, true); //辅助信息 } else { goods.Goods_Code = basicGoodsInfo.GoodsID; goods.Goods_Class_ID = gsClassModel.Goods_Class_ID; goods.Goods_Suppier_Code = basicGoodsInfo.GoodsApplierCode; goods.Goods_Reserve1 = basicGoodsInfo.GoodsInnerCode.ToString(); goods.Goods_Name = basicGoodsInfo.GoodsName; goods.Goods_Flag = basicGoodsInfo.GoodsStatus; goods.Goods_Type = basicGoodsInfo.GoodsType; goods.Goods_Unit = basicGoodsInfo.GoodsUnit; bllGoods.Update(goods); GoodsPropertyOperate(goods.Goods_ID, "fzxx", basicGoodsInfo.GoodsAssistProperty, false); //辅助信息 GoodsPropertyOperate(goods.Goods_ID, "zxbzsl", basicGoodsInfo.GoodsMinPackNum.ToString(), false); //辅助信息 GoodsPropertyOperate(goods.Goods_ID, "wljx", basicGoodsInfo.GoodsPolar, false); //辅助信息 } response.Describe = "数据导入成功!"; response.Status = true; return(response); } catch (Exception ex) { response.Describe = "数据导入错误!" + ex.Message; response.Status = false; return(response); } }