Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }