public ActionResult Edit(int id) { json_delivery tempData = ob_json_deliveryservice.GetEntityById(json_delivery => json_delivery.ID == id && json_delivery.IsDelete == false); ViewBag.json_delivery = tempData; if (tempData == null) { return(View()); } else { json_deliveryViewModel json_deliveryviewmodel = new json_deliveryViewModel(); json_deliveryviewmodel.ID = tempData.ID; json_deliveryviewmodel.DELIVERY_NUMBER = tempData.DELIVERY_NUMBER; json_deliveryviewmodel.POSTING_DATE = tempData.POSTING_DATE; json_deliveryviewmodel.WH_NUMBER = tempData.WH_NUMBER; json_deliveryviewmodel.DELIVERY_QTY = tempData.DELIVERY_QTY; json_deliveryviewmodel.SHIP_TO_NAME = tempData.SHIP_TO_NAME; json_deliveryviewmodel.SHIP_TO_NUMBER = tempData.SHIP_TO_NUMBER; json_deliveryviewmodel.POSTAL_CODE = tempData.POSTAL_CODE; json_deliveryviewmodel.SOLD_TO_NUMBER = tempData.SOLD_TO_NUMBER; json_deliveryviewmodel.SOLD_TO_NAME = tempData.SOLD_TO_NAME; json_deliveryviewmodel.UPLOAD_DATETIME = tempData.UPLOAD_DATETIME; json_deliveryviewmodel.Col1 = tempData.Col1; json_deliveryviewmodel.MakeDate = tempData.MakeDate; json_deliveryviewmodel.MakeMan = tempData.MakeMan; return(View(json_deliveryviewmodel)); } }
public ActionResult Update() { string id = Request["id"] ?? ""; string delivery_number = Request["delivery_number"] ?? ""; string posting_date = Request["posting_date"] ?? ""; string wh_number = Request["wh_number"] ?? ""; string delivery_qty = Request["delivery_qty"] ?? ""; string ship_to_name = Request["ship_to_name"] ?? ""; string ship_to_number = Request["ship_to_number"] ?? ""; string postal_code = Request["postal_code"] ?? ""; string sold_to_number = Request["sold_to_number"] ?? ""; string sold_to_name = Request["sold_to_name"] ?? ""; string upload_datetime = Request["upload_datetime"] ?? ""; string col1 = Request["col1"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; int uid = int.Parse(id); try { json_delivery p = ob_json_deliveryservice.GetEntityById(json_delivery => json_delivery.ID == uid); p.DELIVERY_NUMBER = delivery_number.Trim(); p.POSTING_DATE = posting_date == "" ? DateTime.Now : DateTime.Parse(posting_date); p.WH_NUMBER = wh_number.Trim(); p.DELIVERY_QTY = delivery_qty == "" ? 0 : int.Parse(delivery_qty); p.SHIP_TO_NAME = ship_to_name.Trim(); p.SHIP_TO_NUMBER = ship_to_number.Trim(); p.POSTAL_CODE = postal_code.Trim(); p.SOLD_TO_NUMBER = sold_to_number.Trim(); p.SOLD_TO_NAME = sold_to_name.Trim(); p.UPLOAD_DATETIME = upload_datetime == "" ? DateTime.Now : DateTime.Parse(upload_datetime); p.Col1 = col1.Trim(); p.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); p.MakeMan = makeman == "" ? 0 : int.Parse(makeman); ob_json_deliveryservice.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 delivery_number = Request["delivery_number"] ?? ""; string posting_date = Request["posting_date"] ?? ""; string wh_number = Request["wh_number"] ?? ""; string delivery_qty = Request["delivery_qty"] ?? ""; string ship_to_name = Request["ship_to_name"] ?? ""; string ship_to_number = Request["ship_to_number"] ?? ""; string postal_code = Request["postal_code"] ?? ""; string sold_to_number = Request["sold_to_number"] ?? ""; string sold_to_name = Request["sold_to_name"] ?? ""; string upload_datetime = Request["upload_datetime"] ?? ""; string col1 = Request["col1"] ?? ""; string makedate = Request["makedate"] ?? ""; string makeman = Request["makeman"] ?? ""; try { json_delivery ob_json_delivery = new json_delivery(); ob_json_delivery.DELIVERY_NUMBER = delivery_number.Trim(); ob_json_delivery.POSTING_DATE = posting_date == "" ? DateTime.Now : DateTime.Parse(posting_date); ob_json_delivery.WH_NUMBER = wh_number.Trim(); ob_json_delivery.DELIVERY_QTY = delivery_qty == "" ? 0 : int.Parse(delivery_qty); ob_json_delivery.SHIP_TO_NAME = ship_to_name.Trim(); ob_json_delivery.SHIP_TO_NUMBER = ship_to_number.Trim(); ob_json_delivery.POSTAL_CODE = postal_code.Trim(); ob_json_delivery.SOLD_TO_NUMBER = sold_to_number.Trim(); ob_json_delivery.SOLD_TO_NAME = sold_to_name.Trim(); ob_json_delivery.UPLOAD_DATETIME = upload_datetime == "" ? DateTime.Now : DateTime.Parse(upload_datetime); ob_json_delivery.Col1 = col1.Trim(); ob_json_delivery.MakeDate = makedate == "" ? DateTime.Now : DateTime.Parse(makedate); ob_json_delivery.MakeMan = makeman == "" ? 0 : int.Parse(makeman); ob_json_delivery = ob_json_deliveryservice.AddEntity(ob_json_delivery); ViewBag.json_delivery = ob_json_delivery; } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Index")); }
public JsonResult ImportData() { int _userid = (int)Session["user_id"]; var _bh = Request["bh"] ?? ""; var _rkid = Request["rk"] ?? ""; wms_rukudan _rkd = ServiceFactory.wms_rukudanservice.GetEntityById(p => p.ID == int.Parse(_rkid) && p.IsDelete == false); if (_rkd == null) { return(Json(-1)); } if (_rkd.GongyingshangID != 2) { return(Json(-2)); } int _hzid = (int)_rkd.HuozhuID; json_delivery _del = ServiceFactory.json_deliveryservice.GetEntityById(p => p.DELIVERY_NUMBER == _bh && p.IsDelete == false); if (_del == null) { return(Json(-3)); } json_import _imp = ServiceFactory.json_importservice.GetEntityById(p => p.BillNum == _del.DELIVERY_NUMBER && p.PlanID == _rkd.ID && p.IsDelete == false); if (_imp != null) { return(Json(-4)); } int _i = ServiceFactory.json_batchservice.ImportBatch(_del.DELIVERY_NUMBER, _rkd.KehuDH, _rkd.ID, _del.ID, _userid, _hzid); //记录强生发货单号 if (System.IO.File.Exists("C:\\xy\\DELIVERY_NUMBER.txt")) { StreamWriter sw_ = new StreamWriter("C:\\xy\\DELIVERY_NUMBER.txt", true); if (string.IsNullOrEmpty(_rkd.KehuDH)) { if (_rkd.Beizhu.IndexOf("样品") > -1) { sw_.WriteLine(_del.DELIVERY_NUMBER + "YP"); } else if (_rkd.Beizhu.IndexOf("投诉") > -1) { sw_.WriteLine(_del.DELIVERY_NUMBER + "TS"); } } else { sw_.WriteLine(_del.DELIVERY_NUMBER); } sw_.Close(); } else { } _rkd.Col2 = _rkd.Col2 == null ? (_bh) : (_rkd.Col2 + "/" + _bh); ob_wms_rukudanservice.UpdateEntity(_rkd); return(Json(_i)); }