public ActionResult Edit(int id) { wms_rukumx tempData = ob_wms_rukumxservice.GetEntityById(wms_rukumx => wms_rukumx.ID == id && wms_rukumx.IsDelete == false); ViewBag.wms_rukumx = tempData; if (tempData == null) { return(View()); } else { wms_rukumxViewModel wms_rukumxviewmodel = new wms_rukumxViewModel(); wms_rukumxviewmodel.ID = tempData.ID; wms_rukumxviewmodel.RukuID = tempData.RukuID; wms_rukumxviewmodel.ShangpinID = tempData.ShangpinID; wms_rukumxviewmodel.ShangpinMC = tempData.ShangpinMC; wms_rukumxviewmodel.Zhucezheng = tempData.Zhucezheng; wms_rukumxviewmodel.Guige = tempData.Guige; wms_rukumxviewmodel.Pihao = tempData.Pihao; wms_rukumxviewmodel.Pihao1 = tempData.Pihao1; wms_rukumxviewmodel.Xuliema = tempData.Xuliema; wms_rukumxviewmodel.ShengchanRQ = tempData.ShengchanRQ; wms_rukumxviewmodel.ShixiaoRQ = tempData.ShixiaoRQ; wms_rukumxviewmodel.DaohuoSL = tempData.DaohuoSL; wms_rukumxviewmodel.YishouSL = tempData.YishouSL; wms_rukumxviewmodel.JibenDW = tempData.JibenDW; wms_rukumxviewmodel.BaozhuangDW = tempData.BaozhuangDW; wms_rukumxviewmodel.Huansuanlv = tempData.Huansuanlv; wms_rukumxviewmodel.Changjia = tempData.Changjia; wms_rukumxviewmodel.Chandi = tempData.Chandi; wms_rukumxviewmodel.ShangpinTM = tempData.ShangpinTM; wms_rukumxviewmodel.Zhongliang = tempData.Zhongliang; wms_rukumxviewmodel.Jingzhong = tempData.Jingzhong; wms_rukumxviewmodel.Tiji = tempData.Tiji; wms_rukumxviewmodel.Jifeidun = tempData.Jifeidun; wms_rukumxviewmodel.Beizhu = tempData.Beizhu; wms_rukumxviewmodel.Col1 = tempData.Col1; wms_rukumxviewmodel.Col2 = tempData.Col2; wms_rukumxviewmodel.Col3 = tempData.Col3; wms_rukumxviewmodel.MakeDate = tempData.MakeDate; wms_rukumxviewmodel.MakeMan = tempData.MakeMan; wms_rukumxviewmodel.ShangpinDM = tempData.ShangpinDM; return(View(wms_rukumxviewmodel)); } }
public JsonResult ImportDataU8() { int _userid = (int)Session["user_id"]; var _rkid = Request["rk"] ?? ""; if (string.IsNullOrEmpty(_rkid)) { return(Json(-1)); } wms_rukudan _rkd = ServiceFactory.wms_rukudanservice.GetEntityById(p => p.ID == int.Parse(_rkid) && p.IsDelete == false); if (_rkd == null) { return(Json(-1)); } if (string.IsNullOrEmpty(_rkd.KehuDH)) { return(Json(-2)); } if (_rkd.JihuaID == null) { return(Json(-2)); } var _jhid = _rkd.JihuaID; var _jhmxs = ServiceFactory.cust_rukujihuamxservice.LoadEntities(p => p.JihuaID == _jhid && p.IsDelete == false).ToList(); if (_jhmxs.Count == 0) { return(Json(-3)); } foreach (var jhmx in _jhmxs) { wms_rukumx _rkmx = new wms_rukumx(); _rkmx.RukuID = _rkd.ID; _rkmx.MakeDate = DateTime.Now; _rkmx.MakeMan = _userid; _rkmx.YishouSL = 0; _rkmx.DaohuoSL = jhmx.JihuaSL; _rkmx.ShangpinID = jhmx.ShangpinID; _rkmx.ShangpinDM = jhmx.ShangpinDM; _rkmx.ShangpinMC = jhmx.ShangpinMC; //var spxx = ServiceFactory.base_shangpinxxservice.LoadEntities(p => p.ID == jhmx.ShangpinID && p.IsDelete == false).ToList(); //if (spxx.Count == 0) // return Json(-1); //_rkmx.ShangpinTM = spxx[0].ShangpinTM; _rkmx.BaozhuangDW = jhmx.BaozhuangDW; _rkmx.Chandi = jhmx.Chandi; _rkmx.Changjia = jhmx.Changjia; _rkmx.Guige = jhmx.Guige; _rkmx.Huansuanlv = jhmx.Huansuanlv; _rkmx.JibenDW = jhmx.JibenDW; _rkmx.Pihao = jhmx.Pihao; _rkmx.ShixiaoRQ = jhmx.ShixiaoRQ; _rkmx.Zhucezheng = jhmx.Zhucezheng; _rkmx.Beizhu = jhmx.Beizhu; _rkmx.Col1 = jhmx.Col1; _rkmx.Col2 = jhmx.Col2; _rkmx.Col3 = jhmx.Col3; _rkmx = ServiceFactory.wms_rukumxservice.AddEntity(_rkmx); } return(Json(1)); }
public ActionResult Update() { string id = Request["id"] ?? ""; string rukuid = Request["rukuid"] ?? ""; string shangpinid = Request["shangpinid"] ?? ""; string shangpinmc = Request["shangpinmc"] ?? ""; string zhucezheng = Request["zhucezheng"] ?? ""; string guige = Request["guige"] ?? ""; string pihao = Request["pihao"] ?? ""; string pihao1 = Request["pihao1"] ?? ""; string xuliema = Request["xuliema"] ?? ""; string shengchanrq = Request["shengchanrq"] ?? ""; string shixiaorq = Request["shixiaorq"] ?? ""; string daohuosl = Request["daohuosl"] ?? ""; string yishousl = Request["yishousl"] ?? ""; string jibendw = Request["jibendw"] ?? ""; string baozhuangdw = Request["baozhuangdw"] ?? ""; string huansuanlv = Request["huansuanlv"] ?? ""; string changjia = Request["changjia"] ?? ""; string chandi = Request["chandi"] ?? ""; string shangpintm = Request["shangpintm"] ?? ""; string zhongliang = Request["zhongliang"] ?? ""; string jingzhong = Request["jingzhong"] ?? ""; string tiji = Request["tiji"] ?? ""; string jifeidun = Request["jifeidun"] ?? ""; string beizhu = Request["beizhu"] ?? ""; string col1 = Request["col1"] ?? ""; string col2 = Request["col2"] ?? ""; string col3 = Request["col3"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; string shangpindm = Request["shangpindm"] ?? ""; int uid = int.Parse(id); try { wms_rukumx p = ob_wms_rukumxservice.GetEntityById(wms_rukumx => wms_rukumx.ID == uid); p.RukuID = rukuid == "" ? 0 : int.Parse(rukuid); p.ShangpinID = shangpinid == "" ? 0 : int.Parse(shangpinid); p.ShangpinMC = shangpinmc.Trim(); p.Zhucezheng = zhucezheng.Trim(); p.Guige = guige.Trim(); p.Pihao = pihao.Trim(); p.Pihao1 = pihao1.Trim(); p.Xuliema = xuliema.Trim(); p.ShengchanRQ = shengchanrq == "" ? DateTime.Now : DateTime.Parse(shengchanrq); p.ShixiaoRQ = shixiaorq == "" ? DateTime.Now : DateTime.Parse(shixiaorq); p.DaohuoSL = daohuosl == "" ? 0 : float.Parse(daohuosl); p.YishouSL = yishousl == "" ? 0 : float.Parse(yishousl); p.JibenDW = jibendw.Trim(); p.BaozhuangDW = baozhuangdw.Trim(); p.Huansuanlv = huansuanlv == "" ? 0 : float.Parse(huansuanlv); p.Changjia = changjia.Trim(); p.Chandi = chandi.Trim(); p.ShangpinTM = shangpintm.Trim(); p.Zhongliang = zhongliang == "" ? 0 : float.Parse(zhongliang); p.Jingzhong = jingzhong == "" ? 0 : float.Parse(jingzhong); p.Tiji = tiji == "" ? 0 : float.Parse(tiji); p.Jifeidun = jifeidun == "" ? 0 : float.Parse(jifeidun); p.Beizhu = beizhu.Trim(); p.Col1 = col1.Trim(); p.Col2 = col2.Trim(); p.Col3 = col3.Trim(); p.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); p.MakeMan = makeman == "" ? 0 : int.Parse(makeman); p.ShangpinDM = shangpindm.Trim(); ob_wms_rukumxservice.UpdateEntity(p); ViewBag.saveok = ViewAddTag.ModifyOk; } catch (Exception ex) { Console.WriteLine(ex.Message); ViewBag.saveok = ViewAddTag.ModifyNo; } return(RedirectToAction("Edit", new { id = uid })); }
private wms_shouhuomx AddRecieveRec(wms_rukumx rkmx, int recnum, int op) { if (rkmx == null) { return(null); } if (rkmx.YishouSL + recnum > rkmx.DaohuoSL) { return(null); } wms_shouhuomx _sh = new wms_shouhuomx(); _sh.RukuID = rkmx.RukuID; _sh.RKMXID = rkmx.ID; _sh.ShangpinID = rkmx.ShangpinID; _sh.ShangpinDM = rkmx.ShangpinDM; _sh.ShangpinMC = rkmx.ShangpinMC; _sh.ShangpinTM = rkmx.ShangpinTM; if (rkmx.ShengchanRQ == null) { _sh.ShengchanRQ = DateTime.Now; } else { _sh.ShengchanRQ = rkmx.ShengchanRQ; } if (rkmx.ShixiaoRQ == null) { _sh.ShixiaoRQ = DateTime.Now; } else { _sh.ShixiaoRQ = rkmx.ShixiaoRQ; } _sh.Zhucezheng = rkmx.Zhucezheng; _sh.Guige = rkmx.Guige; _sh.Xuliema = rkmx.Xuliema; _sh.Pihao = rkmx.Pihao; _sh.Pihao1 = rkmx.Pihao1; _sh.JibenDW = rkmx.JibenDW; _sh.BaozhuangDW = rkmx.BaozhuangDW; _sh.Chandi = rkmx.Chandi; _sh.Changjia = rkmx.Changjia; _sh.Huansuanlv = rkmx.Huansuanlv; _sh.MakeMan = op; _sh.MakeDate = DateTime.Now; _sh.Shuliang = recnum; _sh.Col1 = rkmx.Col1; _sh.Col2 = rkmx.Col2; _sh.Col3 = rkmx.Col3; if (rkmx.Zhongliang == null) { _sh.Zhongliang = 0; } else { _sh.Zhongliang = (recnum / rkmx.DaohuoSL) * rkmx.Zhongliang; } if (rkmx.Jingzhong == null) { _sh.Jingzhong = 0; } else { _sh.Jingzhong = (recnum / rkmx.DaohuoSL) * rkmx.Jingzhong; } if (rkmx.Tiji == null) { _sh.Tiji = 0; } else { _sh.Tiji = (recnum / rkmx.DaohuoSL) * rkmx.Tiji; } if (rkmx.Jifeidun == null) { _sh.Jifeidun = 0; } else { _sh.Jifeidun = (recnum / rkmx.DaohuoSL) * rkmx.Jifeidun; } _sh = ServiceFactory.wms_shouhuomxservice.AddEntity(_sh); return(_sh); }