public override BaseResult Update(dynamic entity) { Hashtable param0 = (Hashtable)entity; Ts_Param_Business model = (Ts_Param_Business)param0["model"]; BaseResult br = new BaseResult(); Hashtable param = new Hashtable(); param.Clear(); string[] Process_List = param0["Process_List"].ToString().Split(','); string[] bm_list = { "order_ywlc_cwsh", "order_ywlc_cksh", "order_ywlc_fhqr", "order_ywlc_shqr" }; for (int i = 0; i < Process_List.Length; i++) { param["bm"] = bm_list[i]; param["new_val"] = Process_List[i]; param["id_user_master"] = model.id_user_master; br.Data = DAL.UpdatePart(typeof(Ts_Param_Business), param); } DataCache.Remove(param["id_user_master"] + "_process"); br.Success = true; br.Message.Add(String.Format("更新业务流程。信息:用户主ID:{0},流程:{1}", model.id_user_master, model.bm)); return(br); }
public override BaseResult Add(dynamic entity) { BaseResult br = new BaseResult(); Hashtable param = (Hashtable)entity; Hashtable param0 = new Hashtable(); OrderFlag new_flag_state = CySoft.Model.Flags.OrderFlag.WaitDelivery; Td_Sale_Out_Head head = (Td_Sale_Out_Head)param["head"]; List <Td_Sale_Out_Body> body = (List <Td_Sale_Out_Body>)param["body"]; Ts_Sale_Order_Log ts = (Ts_Sale_Order_Log)param["Ts"]; ShoppingInfo shopping = (ShoppingInfo)param["ShoppingInfo"]; short xh = 1; int dj_digit = 2; int je_digit = 2; foreach (Td_Sale_Out_Body item in body) { xh = xh++; item.dh = head.dh; //设置单号 item.xh = xh; item.sl = item.sl.Digit(dj_digit); //数量 item.sl_ck = item.sl_ck.Digit(dj_digit); item.sl_fh = item.sl_fh.Digit(dj_digit); //折扣 head.sl_sum = +item.sl; head.flag_delete = 0; head.rq_fh = DateTime.Now; xh++; } Ts_Param_Business item0 = new Ts_Param_Business(); param0["id_user_master"] = param["id_user_master"]; IList <Ts_Param_Business> list = DAL.QueryList <Ts_Param_Business>(typeof(Ts_Param_Business), param0); list = list.Where(m => m.bm.IndexOf("ywlc") != -1 && m.val != "0" && m.bm.IndexOf("order_ywlc_cwsh") == -1).ToList(); if (list.Where(m => m.bm == "order_ywlc_cksh").Count() > 0) { item0.bm = "order_ywlc_cksh"; } else if (list.Where(m => m.bm == "order_ywlc_fhqr").Count() > 0) { item0.bm = "order_ywlc_fhqr"; } switch (item0.bm) { case "order_ywlc_cksh": if (list.Where(m => m.bm != "order_ywlc_cksh").Count() > 0) { if (list.Where(m => m.bm != "order_ywlc_cksh").First().bm == "order_ywlc_shqr") { new_flag_state = OrderFlag.Delivered; } else { new_flag_state = OrderFlag.WaitDelivery; } } else { if (list.Count == 0) { new_flag_state = OrderFlag.WaitDelivery; } else { new_flag_state = OrderFlag.Receipted; } } break; case "order_ywlc_fhqr": if (list.Where(m => m.bm != "order_ywlc_fhqr").Count() == 0) { new_flag_state = OrderFlag.Receipted; } else { new_flag_state = OrderFlag.Delivered; } break; case "order_ywlc_shqr": new_flag_state = OrderFlag.Delivered; break; default: new_flag_state = OrderFlag.Receipted; break; } head.flag_state = new_flag_state; DAL.AddRange(body); DAL.Add(head); param.Clear(); param["dh_order"] = head.dh_order; param["dh"] = head.dh; int flag = Td_Sale_Out_BodyDAL.UpdateBody(typeof(Td_Sale_Out_Body), param); if (item0.bm == "order_ywlc_fhqr") { param.Clear(); param["dh"] = head.dh; param["new_company_logistics"] = shopping.company_logistics; param["new_no_logistics"] = shopping.no_logistics; param["new_rq_fh_logistics"] = shopping.rq_fh; param["new_id_fh"] = head.id_create; DAL.UpdatePart(typeof(Td_Sale_Out_Head), param); param.Clear(); param["dh"] = head.dh; param["dh_order"] = head.dh_order; Td_Sale_Out_BodyDAL.UpdatefhCrossingck(typeof(Td_Sale_Out_Body), param); } else if (list.Where(m => m.bm != "order_ywlc_cksh").Count() == 0) { param["dh"] = head.dh; param.Clear(); param["new_company_logistics"] = shopping.company_logistics; param["new_no_logistics"] = shopping.no_logistics; param["new_rq_fh_logistics"] = shopping.rq_fh; param["new_id_fh"] = head.id_create; DAL.UpdatePart(typeof(Td_Sale_Out_Head), param); param.Clear(); param["dh"] = head.dh; param["dh_order"] = head.dh_order; Td_Sale_Out_BodyDAL.Updatefh(typeof(Td_Sale_Out_Body), param); } else if (list.Where(m => m.bm != "order_ywlc_cksh").First().bm == "order_ywlc_shqr") { param["dh"] = head.dh; param.Clear(); param["new_company_logistics"] = shopping.company_logistics; param["new_no_logistics"] = shopping.no_logistics; param["new_rq_fh_logistics"] = shopping.rq_fh; param["new_id_fh"] = head.id_create; DAL.UpdatePart(typeof(Td_Sale_Out_Head), param); param.Clear(); param["dh"] = head.dh; param["dh_order"] = head.dh_order; Td_Sale_Out_BodyDAL.Updatefh(typeof(Td_Sale_Out_Body), param); } #region 跳入分单批量插入出库单 var Fd = new GoodsSkuFdBLL(); Fd.DAL = DAL; var rs = Fd.Query_Sale_Order_Head(head.dh_order); if (rs.flag_fd != 1) { //检查当前单号是否存在上级单号 var Order_Fd = Fd.Query_Sale_Order_Fd(head.dh_order); //存在上级订单 if (Order_Fd != null) { Fd.SaleOut_Out_Fd(head.dh_order, head.dh); } } #endregion ts.dh = head.dh_order; ts.content = "订单已通过出库审核"; DAL.Add(ts); br.Success = true; br.Data = head; br.Message.Add(String.Format("新增出库单。信息:单号:{0}", head.dh)); return(br); }
public override BaseResult Save(dynamic entity) { BaseResult br = new BaseResult(); Td_Sale_Out_Head model = (Td_Sale_Out_Head)entity; Hashtable param = new Hashtable(); Hashtable param0 = new Hashtable(); OrderFlag new_flag_state = CySoft.Model.Flags.OrderFlag.WaitDelivery; param["dh"] = model.dh; param["new_id_edit"] = model.id_edit; param["new_rq_edit"] = DateTime.Now; param["new_remark"] = model.remark; param["new_flag_state"] = CySoft.Model.Flags.OrderFlag.Invalided; DAL.UpdatePart(typeof(Td_Sale_Out_Head), param); param.Clear(); param["dh_order"] = model.dh_order; param0["id_user_master"] = model.id_edit; param0["val"] = 1; param0["not_bm"] = "order_ywlc_cwsh"; param0.Add("sort", "sort_id"); param0.Add("dir", "asc"); IList <Ts_Param_Business> list = DAL.QueryList <Ts_Param_Business>(typeof(Ts_Param_Business), param0); Ts_Param_Business item0 = list.First(); //是否出库审核 if (list.Where(m => m.bm == "order_ywlc_cksh").Count() > 0) { item0.bm = "order_ywlc_cksh"; } //是否发货确认 else if (list.Where(m => m.bm == "order_ywlc_fhqr").Count() > 0) { item0.bm = "order_ywlc_fhqr"; } switch (item0.bm) { case "order_ywlc_cksh": new_flag_state = OrderFlag.WaitOutputCheck; break; case "order_ywlc_fhqr": new_flag_state = OrderFlag.WaitDelivery; break; } param["flag_state"] = new_flag_state; int flag = Td_Sale_Out_BodyDAL.Updatezf(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_UpdateFlag_Fd(model.dh_order, new_flag_state); } #endregion br.Success = true; br.Message.Add(String.Format("作废成功。信息:单号:{0}", model.dh)); return(br); }