public JsonResult NGPick() { int _userid = (int)Session["user_id"]; var _mxid = Request["mx"] ?? ""; if (_mxid == "") { return(Json(-1)); } var _pklist = ob_wms_jianhuoservice.GetPickDetailByMX(int.Parse(_mxid), p => p.DaijianSL > 0); if (_pklist != null) { foreach (var _pk in _pklist.ToList <wms_pick_v>()) { var _pid = _pk.pickid; wms_jianhuo _jh = ob_wms_jianhuoservice.GetEntityById(g => g.ID == _pid && g.IsDelete == false); if (_jh != null) { _jh.Fuhe = false; ob_wms_jianhuoservice.UpdateEntity(_jh); } } } return(Json(1)); }
public JsonResult NGChange() { int _userid = (int)Session["user_id"]; var _ngv = Request["ch"] ?? ""; if (_ngv == "" || _ngv.Length < 2) { return(Json(-1)); } foreach (var ng in _ngv.Split(';')) { if (ng.Length > 2) { string[] _np = ng.Split(','); if (int.Parse(_np[0]) > 0 && int.Parse(_np[1]) > 0) { wms_jianhuo _jh = ob_wms_jianhuoservice.GetEntityById(p => p.ID == int.Parse(_np[0])); if (_jh != null) { wms_jianhuo _njh = ob_wms_jianhuoservice.AddNGPick(_jh, int.Parse(_np[1])); if (_njh != null) { _njh.Fuhe = false; ob_wms_jianhuoservice.UpdateEntity(_njh); } } } } } return(Json(1)); }
public JsonResult DelPick() { int _userid = (int)Session["user_id"]; var _delid = Request["del"] ?? ""; var _ckid = Request["ck"] ?? ""; if (string.IsNullOrEmpty(_delid) || string.IsNullOrEmpty(_ckid)) { return(Json(-1)); } wms_chukudan _ckd = ServiceFactory.wms_chukudanservice.GetEntityById(p => p.ID == int.Parse(_ckid)); if (_ckd == null) { return(Json(-1)); } if (_ckd.JihuaZT > 2) { return(Json(-2)); } wms_jianhuo _jh = ob_wms_jianhuoservice.GetEntityById(p => p.ID == int.Parse(_delid) && p.IsDelete == false); if (_jh == null) { return(Json(-1)); } var b = ob_wms_jianhuoservice.DeleteEntity(_jh); if (!b) { return(Json(-1)); } return(Json(1)); }
public ActionResult Edit(int id) { wms_jianhuo tempData = ob_wms_jianhuoservice.GetEntityById(wms_jianhuo => wms_jianhuo.ID == id && wms_jianhuo.IsDelete == false); ViewBag.wms_jianhuo = tempData; if (tempData == null) { return(View()); } else { wms_jianhuoViewModel wms_jianhuoviewmodel = new wms_jianhuoViewModel(); wms_jianhuoviewmodel.ID = tempData.ID; wms_jianhuoviewmodel.CKMXID = tempData.CKMXID; wms_jianhuoviewmodel.Kuwei = tempData.Kuwei; wms_jianhuoviewmodel.KuweiID = tempData.KuweiID; wms_jianhuoviewmodel.DaijianSL = tempData.DaijianSL; wms_jianhuoviewmodel.Zhongliang = tempData.Zhongliang; wms_jianhuoviewmodel.Jingzhong = tempData.Jingzhong; wms_jianhuoviewmodel.Tiji = tempData.Tiji; wms_jianhuoviewmodel.Jifeidun = tempData.Jifeidun; wms_jianhuoviewmodel.ShijianSL = tempData.ShijianSL; wms_jianhuoviewmodel.JianhuoSM = tempData.JianhuoSM; wms_jianhuoviewmodel.Jianhuoren = tempData.Jianhuoren; wms_jianhuoviewmodel.Col1 = tempData.Col1; wms_jianhuoviewmodel.Col2 = tempData.Col2; wms_jianhuoviewmodel.Col3 = tempData.Col3; wms_jianhuoviewmodel.MakeDate = tempData.MakeDate; wms_jianhuoviewmodel.MakeMan = tempData.MakeMan; wms_jianhuoviewmodel.Fuhe = tempData.Fuhe; return(View(wms_jianhuoviewmodel)); } }
public ActionResult Update() { string id = Request["id"] ?? ""; string ckmxid = Request["ckmxid"] ?? ""; string kuwei = Request["kuwei"] ?? ""; string kuweiid = Request["kuweiid"] ?? ""; string daijiansl = Request["daijiansl"] ?? ""; string zhongliang = Request["zhongliang"] ?? ""; string jingzhong = Request["jingzhong"] ?? ""; string tiji = Request["tiji"] ?? ""; string jifeidun = Request["jifeidun"] ?? ""; string shijiansl = Request["shijiansl"] ?? ""; string jianhuosm = Request["jianhuosm"] ?? ""; string jianhuoren = Request["jianhuoren"] ?? ""; string col1 = Request["col1"] ?? ""; string col2 = Request["col2"] ?? ""; string col3 = Request["col3"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; string fuhe = Request["fuhe"] ?? ""; int uid = int.Parse(id); try { wms_jianhuo p = ob_wms_jianhuoservice.GetEntityById(wms_jianhuo => wms_jianhuo.ID == uid); p.CKMXID = ckmxid == "" ? 0 : int.Parse(ckmxid); p.Kuwei = kuwei.Trim(); p.KuweiID = kuweiid == "" ? 0 : int.Parse(kuweiid); p.DaijianSL = daijiansl == "" ? 0 : float.Parse(daijiansl); 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.ShijianSL = shijiansl == "" ? 0 : float.Parse(shijiansl); p.JianhuoSM = jianhuosm.Trim(); p.Jianhuoren = jianhuoren == "" ? 0 : int.Parse(jianhuoren); 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.Fuhe = fuhe == "" ? false : Boolean.Parse(fuhe); ob_wms_jianhuoservice.UpdateEntity(p); ViewBag.saveok = ViewAddTag.ModifyOk; } catch (Exception ex) { Console.WriteLine(ex.Message); ViewBag.saveok = ViewAddTag.ModifyNo; } return(RedirectToAction("Edit", new { id = uid })); }
public ActionResult Save() { string id = Request["id"] ?? ""; string ckmxid = Request["ckmxid"] ?? ""; string kuwei = Request["kuwei"] ?? ""; string kuweiid = Request["kuweiid"] ?? ""; string daijiansl = Request["daijiansl"] ?? ""; string zhongliang = Request["zhongliang"] ?? ""; string jingzhong = Request["jingzhong"] ?? ""; string tiji = Request["tiji"] ?? ""; string jifeidun = Request["jifeidun"] ?? ""; string shijiansl = Request["shijiansl"] ?? ""; string jianhuosm = Request["jianhuosm"] ?? ""; string jianhuoren = Request["jianhuoren"] ?? ""; string col1 = Request["col1"] ?? ""; string col2 = Request["col2"] ?? ""; string col3 = Request["col3"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; string fuhe = Request["fuhe"] ?? ""; try { wms_jianhuo ob_wms_jianhuo = new wms_jianhuo(); ob_wms_jianhuo.CKMXID = ckmxid == "" ? 0 : int.Parse(ckmxid); ob_wms_jianhuo.Kuwei = kuwei.Trim(); ob_wms_jianhuo.KuweiID = kuweiid == "" ? 0 : int.Parse(kuweiid); ob_wms_jianhuo.DaijianSL = daijiansl == "" ? 0 : float.Parse(daijiansl); ob_wms_jianhuo.Zhongliang = zhongliang == "" ? 0 : float.Parse(zhongliang); ob_wms_jianhuo.Jingzhong = jingzhong == "" ? 0 : float.Parse(jingzhong); ob_wms_jianhuo.Tiji = tiji == "" ? 0 : float.Parse(tiji); ob_wms_jianhuo.Jifeidun = jifeidun == "" ? 0 : float.Parse(jifeidun); ob_wms_jianhuo.ShijianSL = shijiansl == "" ? 0 : float.Parse(shijiansl); ob_wms_jianhuo.JianhuoSM = jianhuosm.Trim(); ob_wms_jianhuo.Jianhuoren = jianhuoren == "" ? 0 : int.Parse(jianhuoren); ob_wms_jianhuo.Col1 = col1.Trim(); ob_wms_jianhuo.Col2 = col2.Trim(); ob_wms_jianhuo.Col3 = col3.Trim(); ob_wms_jianhuo.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); ob_wms_jianhuo.MakeMan = makeman == "" ? 0 : int.Parse(makeman); ob_wms_jianhuo.Fuhe = fuhe == "" ? true : Boolean.Parse(fuhe); ob_wms_jianhuo = ob_wms_jianhuoservice.AddEntity(ob_wms_jianhuo); ViewBag.wms_jianhuo = ob_wms_jianhuo; } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Index")); }
public JsonResult PickDown() { int _userid = (int)Session["user_id"]; var _ckid = Request["ck"] ?? ""; var _loc = Request["loc"] ?? ""; var _ph = Request["ph"] ?? ""; var _xl = Request["xl"] ?? ""; var _sl = Request["sl"] ?? ""; if (string.IsNullOrEmpty(_ckid) || string.IsNullOrEmpty(_loc)) { return(Json(-1)); } if (string.IsNullOrEmpty(_ph) && string.IsNullOrEmpty(_xl)) { return(Json(-1)); } if ((!string.IsNullOrEmpty(_ph)) && (!string.IsNullOrEmpty(_xl))) { return(Json(-1)); } if (string.IsNullOrEmpty(_sl)) { _sl = "1"; } else { if (_sl == "0") { return(Json(-1)); } } var _cargoloc = ServiceFactory.wms_jianhuoservice.GetPickDetail(int.Parse(_ckid), p => p.Kuwei == _loc.Trim()).ToList <wms_pick_v>(); if (_cargoloc == null) { return(Json(-2)); } List <wms_pick_v> _cargo = null; if (!string.IsNullOrEmpty(_ph)) { _ph = BarcodeRead.BatchCode(_ph.Trim()); _cargo = _cargoloc.Where(p => p.Pihao == _ph.Trim()).ToList <wms_pick_v>(); } if (!string.IsNullOrEmpty(_xl)) { _xl = BarcodeRead.SerialNumber(_xl.Trim()); _cargo = _cargoloc.Where(p => p.Xuliema == _xl.Trim()).ToList <wms_pick_v>(); } if (_cargo == null) { return(Json(-2)); } if (_cargo.Count == 1) { wms_jianhuo _jh = ServiceFactory.wms_jianhuoservice.GetEntityById(p => p.ID == _cargo[0].pickid); if (_jh != null) { if (_jh.ShijianSL == null) { _jh.ShijianSL = 0; } if (_cargo[0].DaijianSL >= _jh.ShijianSL + float.Parse(_sl)) { _jh.ShijianSL = _jh.ShijianSL + float.Parse(_sl); ServiceFactory.wms_jianhuoservice.UpdateEntity(_jh); } } } else { float _sjsl = float.Parse(_sl); foreach (var cargo in _cargo) { if (cargo != null) { wms_jianhuo _jh = ServiceFactory.wms_jianhuoservice.GetEntityById(p => p.ID == cargo.pickid); if (_jh != null) { if (_jh.ShijianSL == null) { _jh.ShijianSL = 0; } if (_jh.DaijianSL > _jh.ShijianSL && _sjsl > 0) { if (_jh.DaijianSL >= _jh.ShijianSL + _sjsl) { _jh.ShijianSL = _jh.ShijianSL + _sjsl; _sjsl = 0; } else { _sjsl = _sjsl - ((float)_jh.DaijianSL - (float)_jh.ShijianSL); _jh.ShijianSL = _jh.DaijianSL; } ServiceFactory.wms_jianhuoservice.UpdateEntity(_jh); } } } } } return(Json(1)); }
public JsonResult AddPickGoods() { int _userid = (int)Session["user_id"]; var _pickgoods = Request["pickgd"] ?? ""; if (_pickgoods == "") { return(Json(-1)); } foreach (var _pg in _pickgoods.Split(';')) { if (_pg.Length > 3) { string[] _rec = _pg.Split(','); int _ckmx = int.Parse(_rec[0]); float _pknum = float.Parse(_rec[1]); string _pkmemo = _rec[2]; int _chmx = int.Parse(_rec[3]); wms_chukumx _ck = ServiceFactory.wms_chukumxservice.GetEntityById(p => p.ID == _ckmx); if (_ck != null) { if (_ck.JianhuoSL == null) { _ck.JianhuoSL = 0; } if (_ck.ChukuSL >= _ck.JianhuoSL + _pknum) { //wms_cunhuo _ch = ServiceFactory.wms_cunhuoservice.GetEntityById(p => p.ID == _chmx); wms_cunhuo _ch = ServiceFactory.wms_cunhuoservice.GetEntityByIdNoTracking(p => p.ID == _chmx); if (_ch != null) { if (_pknum > _ch.Shuliang - _ch.DaijianSL) { return(Json(-2)); } var _rt = _pknum / _ch.Shuliang; wms_jianhuo _jh = new wms_jianhuo(); _jh.CKMXID = _ckmx; _jh.DaijianSL = _pknum; _jh.JianhuoRQ = DateTime.Now; _jh.JianhuoSM = _pkmemo == "" ? _ck.Beizhu : _pkmemo; _jh.KCID = _chmx; _jh.Fuhe = _ch.HegeSF; _jh.Kuwei = _ch.Kuwei; _jh.KuweiID = _ch.KuweiID; _jh.Zhongliang = (float)Math.Round((double)(_rt * _ch.Zhongliang), 3); _jh.Jingzhong = (float)Math.Round((double)(_rt * _ch.Jingzhong), 3); _jh.Tiji = (float)Math.Round((double)(_rt * _ch.Tiji), 3); _jh.Jifeidun = (float)Math.Round((double)(_rt * _ch.Jifeidun), 3); _jh.MakeMan = _userid; //扫描拣货后去除 _jh.Jianhuoren = _userid; //_jh.ShijianSL = _pknum; _jh = ob_wms_jianhuoservice.AddEntity(_jh); if (_jh != null) { _ck.Jianhuo = true; _ck.JianhuoSL = _ck.JianhuoSL + _pknum; ServiceFactory.wms_chukumxservice.UpdateEntity(_ck); } } } } } } return(Json(1)); }