public ActionResult Invalid(string obj) { BaseResult br = new BaseResult(); Ts_Sale_Order_Log ts = new Ts_Sale_Order_Log();//日志 try { Td_Sale_Out_Head model = JSON.Deserialize <Td_Sale_Out_Head>(obj); ts.id = BusinessFactory.Utilety.GetNextKey(typeof(Ts_Sale_Order_Log)); ts.id_user = GetLoginInfo <long>("id_user"); ts.id_user_master = GetLoginInfo <long>("id_user_master"); ts.flag_type = 6; ts.rq = DateTime.Now; ts.dh = model.dh; ts.content = "出库单已作废"; model.id_edit = GetLoginInfo <long>("id_user_master"); br = BusinessFactory.ShippingRecord.Save(model); if (br.Success) { BusinessFactory.OrderLog.Add(ts); } } catch (CySoftException ex) { throw ex; } catch (Exception ex) { throw ex; } return(Json(br)); }
public override BaseResult Active(Hashtable param) { BaseResult br = new BaseResult(); var dh = param["dh_order"].ToString(); Hashtable param2 = new Hashtable(); param2.Add("dh", param["dh"]); Td_Sale_Out_Head OutHead = DAL.GetItem <Td_Sale_Out_Head>(SaleOutHead, param2); //如果本发货单的状态为 已发货 if (OutHead.flag_state == OrderFlag.Delivered) { param["new_flag_state"] = CySoft.Model.Flags.OrderFlag.Receipted; DAL.UpdatePart(typeof(Td_Sale_Out_Head), param); } //查已收货 的发货单 param["flag_state"] = 80; param["temp"] = param["dh"]; param.Remove("dh"); br.Data = DAL.QueryList <Td_Sale_Out_Head_Query>(SaleOutHead, param); List <Td_Sale_Out_Head_Query> Sale_Order_Head = (List <Td_Sale_Out_Head_Query>)br.Data; //统计已收货的总数量 decimal?Sale_Order_Head_num = Sale_Order_Head.Sum(e => e.sl_sum).Value; //查询订货商品资料 param["dh"] = param["dh_order"]; IList <Td_Sale_Order_Body_Query> Sale_Order_Body = (IList <Td_Sale_Order_Body_Query>)DAL.QueryList <Td_Sale_Order_Body_Query>(typeof(Td_Sale_Order_Body), param); //统计订货总数量 decimal?Sale_Order_Body_num = Sale_Order_Body.Sum(e => e.sl).Value; //如果发货总数量 等于 订货总数量 if (Sale_Order_Head_num == Sale_Order_Body_num) { param.Remove("flag_state"); param.Remove("dh_order"); param["dh"] = param["dh"]; //改变订货单 头状态为:80 已收货 DAL.UpdatePart(typeof(Td_Sale_Order_Head), param); } #region 分单-批量修改发货状态 var Fd = new GoodsSkuFdBLL(); Fd.DAL = DAL; var rs = Fd.Query_Sale_Order_Head(dh); if (rs.flag_fd != 1) { Fd.SaleOut_ShouHuo_Fd(dh); } #endregion br.Success = true; br.Message.Add(String.Format("确认收货成功。信息:出库单号:{0},订单号:{1}", param["temp"], param["dh"])); return(br); }
public ActionResult DeliverList(string obj) { BaseResult br = new BaseResult(); try { if (!string.IsNullOrEmpty(obj) && obj != "[]") { Hashtable param = new Hashtable(); List <Td_Sale_Out_Head_Query> ck = new List <Td_Sale_Out_Head_Query>(); List <Hashtable> paramList = JSON.Deserialize <List <Hashtable> >(obj); DateTime dt = new DateTime(1900, 1, 1); Ts_Sale_Order_Log ts = new Ts_Sale_Order_Log();//日志 Td_Sale_Out_Head model = new Td_Sale_Out_Head(); long gys = GetLoginInfo <long>("id_supplier"); long id_user = GetLoginInfo <long>("id_user"); long id_user_master = GetLoginInfo <long>("id_user_master"); ts.id_user = id_user; ts.id_user_master = id_user_master; ts.flag_type = 5; ts.content = "订单已通过发货确认"; foreach (Hashtable item in paramList) { //获取出库单头 param.Clear(); param["dh_order"] = item["dh_order"].ToString(); param["sort"] = "flag_state asc, rq_fh desc , rq_create"; param["dir"] = "desc"; param["flag_state"] = OrderFlag.WaitDelivery; br = BusinessFactory.ShippingRecord.Get(param); ck = JSON.Deserialize <List <Td_Sale_Out_Head_Query> >(JSON.Serialize(br.Data)); foreach (Td_Sale_Out_Head_Query it in ck) { model.dh = it.dh; model.flag_state = it.flag_state; ts.id = BusinessFactory.Utilety.GetNextKey(typeof(Ts_Sale_Order_Log)); model.rq_fh = DateTime.Now; model.id_fh = id_user; model.id_gys = gys; model.dh_order = item["dh_order"].ToString(); param.Clear(); param["id_user_master"] = id_user_master; param["model"] = model; br = BusinessFactory.ShippingRecord.Update(param); if (br.Success) { BusinessFactory.OrderLog.Add(ts); } } } } } catch (Exception) { throw; } return(Json(br)); }
public ActionResult Deliver(string obj) { BaseResult br = new BaseResult(); Hashtable param = new Hashtable(); DateTime dt = new DateTime(1900, 1, 1); Ts_Sale_Order_Log ts = new Ts_Sale_Order_Log();//日志 try { Td_Sale_Out_Head model = JSON.Deserialize <Td_Sale_Out_Head>(obj); ts.id = BusinessFactory.Utilety.GetNextKey(typeof(Ts_Sale_Order_Log)); ts.id_user = GetLoginInfo <long>("id_user"); ts.id_user_master = GetLoginInfo <long>("id_user_master"); ts.flag_type = 5; ts.dh = model.dh; ts.content = "订单已通过发货确认"; if (model.rq_fh == dt) { model.rq_fh = DateTime.Now; } model.id_fh = GetLoginInfo <long>("id_user"); model.id_gys = GetLoginInfo <long>("id_supplier"); param["id_user_master"] = GetLoginInfo <long>("id_user_master"); param["model"] = model; br = BusinessFactory.ShippingRecord.Update(param); if (br.Success) { BusinessFactory.OrderLog.Add(ts); } } catch (CySoftException ex) { throw ex; } catch (Exception ex) { throw ex; } return(Json(br)); }
public override BaseResult Update(dynamic entity) { BaseResult br = new BaseResult(); Td_Sale_Out_Head model = (Td_Sale_Out_Head)entity["model"]; Hashtable param = new Hashtable(); Hashtable param0 = new Hashtable(); var ht = new Hashtable(); param["dh"] = model.dh; param["new_company_logistics"] = model.company_logistics; param["new_no_logistics"] = model.no_logistics; param["new_rq_fh_logistics"] = model.rq_fh; param["new_id_fh"] = model.id_fh; param["new_flag_state"] = CySoft.Model.Flags.OrderFlag.Delivered; DAL.UpdatePart(typeof(Td_Sale_Out_Head), param); bool flag = true; param0["id_user_master"] = entity["id_user_master"]; IList <Ts_Param_Business> list = DAL.QueryList <Ts_Param_Business>(typeof(Ts_Param_Business), param0); if (list.Where(e => e.bm == "order_ywlc_shqr" && e.val != "0").Count() > 0) { flag = true; } else { flag = false; } param.Clear(); param["dh"] = model.dh; param["dh_order"] = model.dh_order; Td_Sale_Out_BodyDAL.Updatefh(typeof(Td_Sale_Out_Body), param); if (!flag) { ///更新出库单状态为已完成 ht.Add("id_gys", model.id_gys); ht.Add("dh", model.dh); ht.Add("new_flag_state", 80); ht.Add("new_id_edit", param["id_user"]); ht.Add("new_rq_edit", DateTime.Now); DAL.UpdatePart(typeof(Td_Sale_Out_Head), ht); ///更新订单状态为已完成 ht.Remove("dh"); ht.Add("dh", model.dh_order); ht.Add("flag_state", 70); DAL.UpdatePart(typeof(Td_Sale_Order_Head), ht); br.Success = true; param["id_gys"] = model.id_gys; //Td_Sale_Out_BodyDAL.Updatefh(typeof(Td_Sale_Out_Body), param); //Td_Sale_Out_BodyDAL.UpdateBatchConfirm(typeof(Td_Sale_Out_Body), param); } #region 分单-批量修改发货状态 var Fd = new GoodsSkuFdBLL(); Fd.DAL = DAL; //检查当前单号是否存在上级单号 var Order_Fd = Fd.Query_Sale_Order_Fd(model.dh_order); //存在上级订单 if (Order_Fd != null) { Fd.SaleOut_FH_Fd(model.dh_order); } #endregion br.Success = true; br.Message.Add(String.Format("发货成功。信息:单号:{0}", model.dh)); return(br); }
public ActionResult Out(string obj) { BaseResult br = new BaseResult(); try { Hashtable param = JSON.Deserialize <Hashtable>(obj); ParamVessel p = new ParamVessel(); p.Add("head", null, HandleType.ReturnMsg); p.Add("body", null, HandleType.ReturnMsg); p.Add("ShoppingInfo", null, HandleType.Remove); param = param.Trim(p); Td_Sale_Out_Head head = JSON.ConvertToType <Td_Sale_Out_Head>(param["head"]); head.id_gys = GetLoginInfo <long>("id_supplier");//int.Parse(param["id_supplier"].ToString()); List <Td_Sale_Out_Body> body = JSON.ConvertToType <List <Td_Sale_Out_Body> >(param["body"]); ShoppingInfo shoppinginfo = JSON.ConvertToType <ShoppingInfo>(param["ShoppingInfo"]); Ts_Sale_Order_Log ts = new Ts_Sale_Order_Log();//日志 //单号 赋值 if (head.id_cgs <= 0) { br.Success = false; br.Message.Add("未知采购商,请刷新后再试!"); br.Level = ErrorLevel.Warning; return(Json(br)); } if (head.dh_order.IsEmpty()) { br.Success = false; br.Message.Add("订单号丢失,请刷新后再试!"); br.Level = ErrorLevel.Warning; return(Json(br)); } if (head.id_gys <= 0) { br.Success = false; br.Message.Add("未知供应商,请刷新后再试!"); br.Level = ErrorLevel.Warning; return(Json(br)); } if (body.Count < 1) { br.Success = false; br.Message.Add("<h5>参数错误</h5>"); br.Message.Add("没有可保存的商品!"); br.Level = ErrorLevel.Warning; return(Json(br)); } int xh = 1; foreach (var item in body) { if (item != null) { if (item.id_sku < 1) { br.Success = false; br.Message.Add("<h5>参数错误</h5>"); br.Message.Add(String.Format("[代码:303],第{0}行数据中商品id有误!", xh)); br.Level = ErrorLevel.Warning; return(Json(br)); } if (item.sl <= 0m) { br.Success = false; br.Message.Add("<h5>参数错误</h5>"); br.Message.Add(String.Format("[代码:303],第{0}行数据中商品数量有误!", xh)); br.Level = ErrorLevel.Warning; return(Json(br)); } //if (item.zhl <= 0m) //{ // br.Success = false; // br.Message.Add("<h5>参数错误</h5>"); // br.Message.Add(String.Format("[代码:303],第{0}行数据中包装数有误!", xh)); // br.Level = ErrorLevel.Warning; // return Json(br); //} xh++; } } br = BusinessFactory.Utilety.GetNextDH(head, typeof(Td_Sale_Out_Head)); if (!br.Success) { return(Json(br)); } ts.id = BusinessFactory.Utilety.GetNextKey(typeof(Ts_Sale_Order_Log)); ts.id_user = GetLoginInfo <long>("id_user"); ts.id_user_master = GetLoginInfo <long>("id_user_master"); ts.flag_type = 4; head.id_create = GetLoginInfo <long>("id_user"); head.id_edit = GetLoginInfo <long>("id_user"); head.flag_state = CySoft.Model.Flags.OrderFlag.WaitDelivery; param.Clear(); param.Add("head", head); param.Add("body", body); param.Add("Ts", ts); param.Add("id_user_master", GetLoginInfo <long>("id_user_master")); param.Add("ShoppingInfo", shoppinginfo); br = BusinessFactory.ShippingRecord.Add(param); return(Json(br)); } catch (CySoftException ex) { throw ex; } catch (Exception ex) { throw ex; } }
public ActionResult OutList(string obj) { BaseResult br = new BaseResult(); try { if (!string.IsNullOrEmpty(obj) && obj != "[]") { Hashtable param = new Hashtable(); List <Hashtable> paramList = JSON.Deserialize <List <Hashtable> >(obj); List <Td_Sale_Out_Body> body = new List <Td_Sale_Out_Body>(); List <Td_Sale_Out_Body> bodyQuery = new List <Td_Sale_Out_Body>(); Ts_Sale_Order_Log ts = new Ts_Sale_Order_Log();//日志 ShoppingInfo shoppinginfo = new ShoppingInfo(); if (shoppinginfo != null) { if (shoppinginfo.company_logistics == "") { shoppinginfo.company_logistics = "暂无"; } if (shoppinginfo.no_logistics == "") { shoppinginfo.no_logistics = "暂无"; } if (shoppinginfo.rq_fh == "") { shoppinginfo.rq_fh = DateTime.Now.ToString(); } } long gys = GetLoginInfo <long>("id_supplier"); long id_user = GetLoginInfo <long>("id_user"); long id_user_master = GetLoginInfo <long>("id_user_master"); foreach (Hashtable item in paramList) { Td_Sale_Out_Head head = new Td_Sale_Out_Head(); head.dh_order = item["dh_order"].ToString(); head.id_cgs = Convert.ToInt32(item["id_cgs"]); head.id_gys = gys; param.Clear(); param["id_gys"] = gys; param["sort"] = "sl_ck"; param["dir"] = "desc"; param.Add("dh", head.dh_order); br = BusinessFactory.Order.GetAll(param); if (br.Data != null) { body.Clear(); body = JSON.Deserialize <List <Td_Sale_Out_Body> >(JSON.Serialize(br.Data)); bodyQuery = JSON.Deserialize <List <Td_Sale_Out_Body> >(JSON.Serialize(br.Data)); if (head.id_cgs > 0 && !head.dh_order.IsEmpty() && head.id_gys > 0 || body.Count > 0) { int index = 0; foreach (Td_Sale_Out_Body bq in bodyQuery) { bq.dh_order = bq.dh; bq.dh = ""; bq.xh_order = Convert.ToInt16(index++); bq.sl = bq.sl - bq.sl_ck; } //for (int i = 0; i < bodyQuery.Count; i++) //{ // //if (bodyQuery[i].sl - bodyQuery[i].sl_ck <= 0) // //{ // // bodyQuery.RemoveAt(i); // //} // //else // //{ // // bodyQuery[i].dh_order = bodyQuery[i].dh; // // bodyQuery[i].dh = ""; // // bodyQuery[i].xh_order = Convert.ToInt16(i++); // // bodyQuery[i].sl = bodyQuery[i].sl - bodyQuery[i].sl_ck; // // index++; // //} // bodyQuery[i].dh_order = bodyQuery[i].dh; // bodyQuery[i].dh = ""; // bodyQuery[i].xh_order = Convert.ToInt16(i++); // bodyQuery[i].sl = bodyQuery[i].sl - bodyQuery[i].sl_ck; //} br = BusinessFactory.Utilety.GetNextDH(head, typeof(Td_Sale_Out_Head)); if (br.Success) { ts.id = BusinessFactory.Utilety.GetNextKey(typeof(Ts_Sale_Order_Log)); ts.id_user = id_user; ts.id_user_master = id_user_master; ts.flag_type = 4; head.id_create = id_user; head.id_edit = id_user; param.Clear(); param.Add("head", head); param.Add("body", bodyQuery); param.Add("ShoppingInfo", shoppinginfo); param.Add("Ts", ts); param.Add("id_user_master", id_user_master); br = BusinessFactory.ShippingRecord.Add(param); } } } } } else { br.Success = false; br.Message.Add("无可出库的订单!"); br.Level = ErrorLevel.Warning; return(Json(br)); } return(Json(br)); } catch (CySoftException ex) { throw ex; } catch (Exception ex) { throw ex; } }