Skip to content
CyptService.cs 24.9 KiB
Newer Older
Jack Dan's avatar
Jack Dan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ces.IBLL;
using Ces.DAL;
using Ces.Lib;
using Hxj.Data;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using System.Collections;
using Ces.Model;

namespace Ces.BLL
{
    public partial class CyptService : BaseService, ICyptService
    {

        public CyptService() : base(RepositoryFactory.CyptFactory) { }

        public void GiveDeliveryInPlatform(ArrayList arr, string HostId)
        {
            RepositoryFactory.CyptFactory   .GiveDeliveryInPlatform(arr, HostId);
        }

        public void GiveSupplierInPlatform(ArrayList arr, string HostId)
        {
            RepositoryFactory.CyptFactory.GiveSupplierInPlatform(arr, HostId);
        }

        /// <summary>
        /// 获得订单列表
        /// </summary>
        /// <param name="RootDeliveryID"></param>
        /// <param name="OrderDate"></param>
        /// <param name="SupplierID"></param>
        /// <returns></returns>
        public DataTable GetOrderStatusList(string RootDeliveryID, int OrderDate, string SupplierID)
        {
            return RepositoryFactory.CyptFactory.GetOrderStatusList(RootDeliveryID, OrderDate, SupplierID);
        }

        public DataTable GetSupplierPriceList(string SupplierID)
        {
            return RepositoryFactory.CyptFactory.GetSupplierPriceList(SupplierID);
        }

        public DataTable GetSupplierPriceList(string BigTypeID, string SupplierID)
        {
            return RepositoryFactory.CyptFactory.GetSupplierPriceList(BigTypeID,SupplierID);
        }


        public DataTable GetAddOrderList(string DeliveryID, int OrderDate)
        {
            return RepositoryFactory.CyptFactory.GetAddOrderList(DeliveryID, OrderDate);
        }

        public DataTable GetAddOrderList(string DeliveryID, int OrderDate, string OrderId)
        {
            return RepositoryFactory.CyptFactory.GetAddOrderList(DeliveryID, OrderDate, OrderId);
        }

        public DataTable GetAddOrderList(string DeliveryID, int OrderDate, int Batch)
        {
            return RepositoryFactory.CyptFactory.GetAddOrderList(DeliveryID, OrderDate, Batch);
        }

        //public DataTable GetAddOrderList(string DeliveryID, int OrderDate, int Batch, string SupplierID)
        //{
        //    return RepositoryFactory.CyptFactory.GetAddOrderList(DeliveryID, OrderDate, Batch, SupplierID);
        //}


        public DataTable GetAddOrderList(UserInfo ui, int OrderDate, int Batch, string SupplierID)
        {

            if (ui.Role == 1)
            {
                return RepositoryFactory.CyptFactory.GetAddOrderList(Guid.Empty.ToString(),ConfigHelper.GetConfigAppSetting("DeliveryTopID"), OrderDate, Batch, SupplierID);
            }
            else if (ui.Role == 2)
            {
                return RepositoryFactory.CyptFactory.GetAddOrderList(ui.PlatformID.ToString(), ui.GroupID.ToString(), OrderDate, Batch, SupplierID);
            }
            else if (ui.Role == 3)
            {
                return RepositoryFactory.CyptFactory.GetAddOrderList(Guid.Empty.ToString(), ui.GroupID.ToString(), OrderDate, Batch, SupplierID);
            }
            else if (ui.Role == 4)
            {
                return RepositoryFactory.CyptFactory.GetAddOrderList(Guid.Empty.ToString(), ConfigHelper.GetConfigAppSetting("DeliveryTopID"), OrderDate, Batch, ui.GroupID.Value.ToSafeString());
            }
            else
            {
                return RepositoryFactory.CyptFactory.GetAddOrderList(Guid.Empty.ToString(), Guid.Empty.ToString(), 0, 0, Guid.Empty.ToString());
            }
        }

        //public DataTable GetAddOrderList(string PlatformID, string DeliveryID, int OrderDate, int Batch, string SupplierID)
        //{
        //    return RepositoryFactory.CyptFactory.GetAddOrderList(DeliveryID, OrderDate, Batch, SupplierID);
        //}

        public DataSet GetOrderCheckListShow(string DeliveryID, string SupplierID, DateTime BeginDate, DateTime EndDate)
        {
            return RepositoryFactory.CyptFactory.GetOrderCheckListShow(DeliveryID, SupplierID, BeginDate, EndDate);
        }

        public void GiveOrderDetail(List<MyOrder_Detail> listNew, MyOrder_Info info)
        {
            RepositoryFactory.CyptFactory.GiveOrderDetail(listNew, info);
        }

        public GroupInfo GetMainDelivery(string DeliveryID, string TopID)
        {
            return RepositoryFactory.CyptFactory.GetMainDelivery(DeliveryID, TopID);
        }


        /// <summary>
        /// 下单时获取商品小类
        /// </summary>
        /// <param name="DeliveryID"></param>
        /// <param name="OrderDate"></param>
        /// <returns></returns>
        public DataTable GetGoodsTypeForOrder(string DeliveryID, int OrderDate)
        {
            return RepositoryFactory.CyptFactory.GetGoodsTypeForOrder(DeliveryID, OrderDate);

        }

        public DataTable GetStockTakingInit(string DeliveryID, DateTime EndPandianDate)
        {
            return RepositoryFactory.CyptFactory.GetStockTakingInit(DeliveryID, EndPandianDate);
        }

        public DataTable GetHistoryPrice(string SupplierID)
        {
            return RepositoryFactory.CyptFactory.GetHistoryPrice(SupplierID);
        }

        public int GivePriceListLS(Ces.Model.Supplier_PriceSheetLS psls)
        {
            return RepositoryFactory.CyptFactory.GivePriceListLS(psls);
        }
        public int GivePriceList(Ces.Model.Supplier_PriceSheet psl)
        {
            return RepositoryFactory.CyptFactory.GivePriceList(psl);
        }

        public bool GiveOrderTemp(List<Ces_CYPT_OrderTemp> list)
        {
            return RepositoryFactory.CyptFactory.GiveOrderTemp(list);
        }

        public bool GiveTotalOrderApply(List<MyOrder_Info> list)
        {
            return RepositoryFactory.CyptFactory.GiveTotalOrderApply(list);
        }

        public bool GiveTotalOrderApply(List<MyOrder_Info> list, int OrderStatus)
        {
            return RepositoryFactory.CyptFactory.GiveTotalOrderApply(list, OrderStatus);
        }


        public bool GiveSpecWarehousing(Warehouse_Inventory wi, List<Warehouse_InventoryDetail> list, Warehouse_Inventory wiGet, List<Warehouse_InventoryDetail> listGet)
        {
            return RepositoryFactory.CyptFactory.GiveSpecWarehousing(wi, list, wiGet, listGet);
        }

        public bool GiveSpecWarehousingNew(Warehouse_InventoryIn wii, List<Warehouse_InventoryInDetail> list, Warehouse_InventoryOut wiGet, List<Warehouse_InventoryOutDetail> listGet)
        {
            return RepositoryFactory.CyptFactory.GiveSpecWarehousingNew(wii, list, wiGet, listGet);
        }

        public DataTable GetAuthOrderList(string PlatformID, string SupplierID, int OrderDate, int Batch)
        {
            return RepositoryFactory.CyptFactory.GetAuthOrderList(PlatformID, SupplierID, OrderDate, Batch);
        }
        public DataTable GetAuthOrderListByOrderStatus(string PlatformID, string SupplierID, int OrderDate, int Batch,int OrderStatus)
        {
            return RepositoryFactory.CyptFactory.GetAuthOrderListByOrderStatus(PlatformID, SupplierID, OrderDate, Batch, OrderStatus);
        }

        public DataTable GetGetGroupInfoAll(string DeliveryKey)
        {
            return RepositoryFactory.CyptFactory.GetGetGroupInfoAll(DeliveryKey);
        }

        public DataTable GetGroupInfoAllForDelivery(string DeliveryKey)
        {
            return RepositoryFactory.CyptFactory.GetGroupInfoAllForDelivery(DeliveryKey);
        }

        public DataTable GetGetGoodsTypeAll(string TopKey)
        {
            return RepositoryFactory.CyptFactory.GetGetGoodsTypeAll(TopKey);
        }

        public DataTable GetGoodsForAddList(DateTime startPandianDate, DateTime endPandianDate, string DeliveryID, string SupplierID, string CheckStockID)
        {
            return RepositoryFactory.CyptFactory.GetGoodsForAddList(startPandianDate, endPandianDate, DeliveryID, SupplierID, CheckStockID);
        }

        public DataTable GetGoodsForViewAll(string DeliveryID, int GetGoodsDate)
        {
            return RepositoryFactory.CyptFactory.GetGoodsForViewAll(DeliveryID, GetGoodsDate);
        }

        public DataTable GetGetGoodsInfoList(DateTime BeginDate, DateTime EndDate, string DeliveryID)
        {
            return RepositoryFactory.CyptFactory.GetGetGoodsInfoList(BeginDate, EndDate.AddDays(1), DeliveryID);
        }

        public DataTable GetGetGoodsPaperInfoList(DateTime BeginDate, DateTime EndDate, string DeliveryID)
        {
            return RepositoryFactory.CyptFactory.GetGetGoodsPaperInfoList(BeginDate, EndDate.AddDays(1), DeliveryID);
        }

        public DataTable GetGetGoodsPaperInfoForDay(DateTime BeginDate, DateTime EndDate, string DeliveryID, string SupplierId)
        {
            return RepositoryFactory.CyptFactory.GetGetGoodsPaperInfoForDay(BeginDate, EndDate.AddDays(1), DeliveryID, SupplierId);
        }


        public DataSet GetGetGoodsPaperPrintBuilder(DateTime BeginDate, DateTime EndDate, string DeliveryID, string PlatformID)
        {
            return RepositoryFactory.CyptFactory.GetGetGoodsPaperPrintBuilder(BeginDate, EndDate.AddDays(1), DeliveryID, PlatformID);
        }

        public DataSet GetGetGoodsPaperPrintBuilderNew(int BeginDateInt, int EndDateInt, string DeliveryID, string PlatformID)
        {
            return RepositoryFactory.CyptFactory.GetGetGoodsPaperPrintBuilderNew(BeginDateInt, EndDateInt, DeliveryID, PlatformID);
        }

        public bool UpdateOrderInfoStatus(string OrderId, int Status)
        {
            return RepositoryFactory.CyptFactory.UpdateOrderInfoStatus(OrderId, Status);
        }

        public bool UpdateOrderInfoStatus(string OrderId, int Status, string AuthNote, string SupplierNote)
        {
            return RepositoryFactory.CyptFactory.UpdateOrderInfoStatus(OrderId, Status, AuthNote, SupplierNote);
        }

        public bool UpdateOrderInfoStatus(string OrderId, int Status, string AuthNote, string SupplierNote, int IsOnAddStatus)
        {
            return RepositoryFactory.CyptFactory.UpdateOrderInfoStatus(OrderId, Status, AuthNote, SupplierNote, IsOnAddStatus);
        }

        public bool OrderAcceptAction(MyOrder_Accept acc, List<MyOrder_AcceptDetail> list)
        {
            return RepositoryFactory.CyptFactory.OrderAcceptAction(acc, list);
        }

        public DataTable GetDaysGetGoodsStatistics(DateTime BeginDate, DateTime EndDate, string DeliveryID, string SupplierID, string PlatformID)
        {
            return RepositoryFactory.CyptFactory.GetDaysGetGoodsStatistics(BeginDate, EndDate, DeliveryID, SupplierID, PlatformID);
        }

        public DataSet GetGetGoodsStockForMonth(int BeginDate, int EndDate, string DeliveryID, string PlatformID)
        {
            return RepositoryFactory.CyptFactory.GetGetGoodsStockForMonth(BeginDate, EndDate, DeliveryID,PlatformID);
        }

        public DataTable GetDeliveryGoods(DateTime OrderDate, string DeliveryID,string BigTypeID, string KeyLike)
        {
            return RepositoryFactory.CyptFactory.GetDeliveryGoods(OrderDate, DeliveryID, BigTypeID, KeyLike);
        }

        public DataTable GetDeliveryGoodsBySupplierID(DateTime OrderDate,string DeliveryID, string SupplierID,string BigTypeID, string KeyLike)
        {
            return RepositoryFactory.CyptFactory.GetDeliveryGoodsBySupplierID(OrderDate, DeliveryID, SupplierID, BigTypeID, KeyLike);
        }

        public DataTable GetGoodTypeByDeliveryID(string DeliveryID, string GoodSortID)
        {
            return RepositoryFactory.CyptFactory.GetGoodTypeByDeliveryID(DeliveryID, GoodSortID);
        }

        public bool GiveDeliveryGoods(string SortID,string DeliveryID, List<Delivery_Goods> list)
        {
            return RepositoryFactory.CyptFactory.GiveDeliveryGoods(SortID,DeliveryID, list);
        }

        public bool GiveStockTaking(tbl_CheckStockInfo csi, List<tbl_CheckStockDetail> list)
        {
            return RepositoryFactory.CyptFactory.GiveStockTaking(csi,list);
        }

        public bool GivePriceSheetDetail(List<Supplier_PriceSheetDetail> list)
        {
            return RepositoryFactory.CyptFactory.GivePriceSheetDetail(list);
        }

        public bool GivePriceSheetDetailSub(List<Supplier_PriceSheetDetailSub> list)
        {
            return RepositoryFactory.CyptFactory.GivePriceSheetDetailSub(list);
        }

        public DataTable GetStockTakingPaper(string DeliveryID, DateTime PandianDate)
        {
            return RepositoryFactory.CyptFactory.GetStockTakingPaper(DeliveryID, PandianDate);
        }

        public DataTable GetGoodsStockDetail(string DeliveryID, string PlatformID, int LastDate)
        {
            return RepositoryFactory.CyptFactory.GetGoodsStockDetail(DeliveryID, PlatformID, LastDate);
        }

        public DataSet GetGoodsStockForDep(string DeliveryID, string PlatformID, int LastDate)
        {
            return RepositoryFactory.CyptFactory.GetGoodsStockForDep(DeliveryID, PlatformID, LastDate);
        }

        public DataTable GetNewGoodsShow(string PlatformID, string DeliveryID)
        {
            return RepositoryFactory.CyptFactory.GetNewGoodsShow(PlatformID, DeliveryID);
        }

        public DataTable GetIndexShow(string PlatformID, string DeliveryID, int OrderStatus)
        {
            return RepositoryFactory.CyptFactory.GetIndexShow(PlatformID, DeliveryID, OrderStatus);
        }

        public DataTable GetSupplier(UserInfo ui, WhereClip sqlwcp)
        {
            DataTable dtSupplier = new DataTable();

            WhereClip wcp = new WhereClip();

            wcp = wcp.And(sqlwcp);

            //wcp = wcp.And(V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormIsDel == 0);

            Field[] fields = new Field[] { V_Ces_CYPT_DeliveryAndSupplierInPlatform._.SupplierId, V_Ces_CYPT_DeliveryAndSupplierInPlatform._.SupplierName };

            GroupByClip gbc = V_Ces_CYPT_DeliveryAndSupplierInPlatform._.SupplierId.GroupBy & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.SupplierName.GroupBy;

            if (ui.Role == 1)
            {

            }else if (ui.Role == 2)
            {
                wcp = wcp.And(V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormID == ui.PlatformID);

                gbc = gbc & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormID.GroupBy;
            }
            else if (ui.Role == 3)
            {
                wcp = wcp.And(V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryId == ui.GroupID);

                gbc = gbc & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryId.GroupBy;
            }
            else if (ui.Role == 4)
            {
                wcp = wcp.And(V_Ces_CYPT_DeliveryAndSupplierInPlatform._.SupplierId == ui.GroupID);
            }
            else
            {
                wcp = wcp.And(V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormID == Guid.Empty);
            }
            //dtSort = cyptService.GetListGroupBy<V_Ces_CYPT_DeliveryGoodsBySupplierID>(new WhereClip().And(V_Ces_CYPT_DeliveryGoodsBySupplierID._.DeliveryID == DeliveryID.ToSafeGuid()), new Field[] { V_Ces_CYPT_DeliveryGoodsBySupplierID._.DeliveryID, V_Ces_CYPT_DeliveryGoodsBySupplierID._.ParentID, V_Ces_CYPT_DeliveryGoodsBySupplierID._.ParentTypeName }, V_Ces_CYPT_DeliveryGoodsBySupplierID._.DeliveryID.GroupBy & V_Ces_CYPT_DeliveryGoodsBySupplierID._.ParentID.GroupBy & V_Ces_CYPT_DeliveryGoodsBySupplierID._.ParentTypeName.GroupBy);

            dtSupplier = RepositoryFactory.BaseFactory.GetListGroupBy<V_Ces_CYPT_DeliveryAndSupplierInPlatform>(
                new WhereClip().And(wcp), fields, gbc);

            return dtSupplier;

        }

        public DataTable GetDelivery(UserInfo ui, WhereClip sqlwcp)
        {
            DataTable dtDelivery = new DataTable();

            WhereClip wcp = new WhereClip();

            wcp = wcp.And(sqlwcp);

            Field[] fields = new Field[] { V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryId, V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryName, V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryParentId };

            GroupByClip gbc = V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryId.GroupBy & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryName.GroupBy & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryParentId.GroupBy;

            if (ui.Role == 1)
            {

            }
            else if (ui.Role == 2)
            {
                wcp = wcp.And(V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormID == ui.PlatformID);

                gbc = gbc & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormID.GroupBy;
            }
            else if (ui.Role == 3)
            {
                wcp = wcp.And(V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryId == ui.GroupID);

                gbc = gbc & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryId.GroupBy;
            }
            else if (ui.Role == 4)
            {
                wcp = wcp.And(V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormID == Guid.Empty);

                gbc = gbc & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormID.GroupBy;
            }
            else
            {
                wcp = wcp.And(V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormID == Guid.Empty);

                gbc = gbc & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormID.GroupBy;
            }
            //dtSort = cyptService.GetListGroupBy<V_Ces_CYPT_DeliveryGoodsBySupplierID>(new WhereClip().And(V_Ces_CYPT_DeliveryGoodsBySupplierID._.DeliveryID == DeliveryID.ToSafeGuid()), new Field[] { V_Ces_CYPT_DeliveryGoodsBySupplierID._.DeliveryID, V_Ces_CYPT_DeliveryGoodsBySupplierID._.ParentID, V_Ces_CYPT_DeliveryGoodsBySupplierID._.ParentTypeName }, V_Ces_CYPT_DeliveryGoodsBySupplierID._.DeliveryID.GroupBy & V_Ces_CYPT_DeliveryGoodsBySupplierID._.ParentID.GroupBy & V_Ces_CYPT_DeliveryGoodsBySupplierID._.ParentTypeName.GroupBy);

            dtDelivery = RepositoryFactory.BaseFactory.GetListGroupBy<V_Ces_CYPT_DeliveryAndSupplierInPlatform>(
                new WhereClip().And(wcp), fields, gbc);

            return dtDelivery;

        }

        public DataTable GetDelivery(UserInfo ui, WhereClip sqlwcp,bool isWithSon)
        {
            DataTable dtDelivery = new DataTable();

            WhereClip wcp = new WhereClip();

            //Field[] fields = new Field[] { V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryId, V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryName, V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryParentId };

            //GroupByClip gbc = V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryId.GroupBy & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryName.GroupBy & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryParentId.GroupBy;

            if (ui.Role == 1)
            {
                wcp = wcp.And(V_Ces_CYPT_DeliveryAllInPlatform._.ParentID == ConfigHelper.GetConfigAppSetting("DeliveryTopID"));
            }
            else if (ui.Role == 2)
            {
                wcp = wcp.And(V_Ces_CYPT_DeliveryAllInPlatform._.PlatFormId == ui.PlatformID).And(V_Ces_CYPT_DeliveryAllInPlatform._.ParentID==ConfigHelper.GetConfigAppSetting("DeliveryTopID"));
               // gbc = gbc & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormID.GroupBy;
            }
            else if (ui.Role == 3)
            {
                if (isWithSon)
                {
                    wcp = wcp.And(V_Ces_CYPT_DeliveryAllInPlatform._.GroupID == ui.GroupID || V_Ces_CYPT_DeliveryAllInPlatform._.ParentID == ui.GroupID);
                }
                else
                {
                    wcp = wcp.And(V_Ces_CYPT_DeliveryAllInPlatform._.GroupID == ui.GroupID);
                }
                //gbc = gbc & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.DeliveryId.GroupBy;
            }
            else if (ui.Role == 4)
            {
                wcp = wcp.And(V_Ces_CYPT_DeliveryAllInPlatform._.PlatFormId == Guid.Empty);

                //gbc = gbc & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormID.GroupBy;
            }
            else
            {
                wcp = wcp.And(V_Ces_CYPT_DeliveryAllInPlatform._.PlatFormId == Guid.Empty);

                //gbc = gbc & V_Ces_CYPT_DeliveryAndSupplierInPlatform._.PlatFormID.GroupBy;
            }
            //dtSort = cyptService.GetListGroupBy<V_Ces_CYPT_DeliveryGoodsBySupplierID>(new WhereClip().And(V_Ces_CYPT_DeliveryGoodsBySupplierID._.DeliveryID == DeliveryID.ToSafeGuid()), new Field[] { V_Ces_CYPT_DeliveryGoodsBySupplierID._.DeliveryID, V_Ces_CYPT_DeliveryGoodsBySupplierID._.ParentID, V_Ces_CYPT_DeliveryGoodsBySupplierID._.ParentTypeName }, V_Ces_CYPT_DeliveryGoodsBySupplierID._.DeliveryID.GroupBy & V_Ces_CYPT_DeliveryGoodsBySupplierID._.ParentID.GroupBy & V_Ces_CYPT_DeliveryGoodsBySupplierID._.ParentTypeName.GroupBy);

            wcp = wcp.And(sqlwcp);

            dtDelivery = RepositoryFactory.BaseFactory.GetList<V_Ces_CYPT_DeliveryAllInPlatform>(Common.Cpc(wcp, 0,0,"lv","ASC"));

            return dtDelivery;

        }

        public bool GiveSplitTable(string year)
        {
            return RepositoryFactory.CyptFactory.GiveSplitTable(year);
        }

        public bool CancelPartOrder(List<MyOrder_Info> list)
        {
            return RepositoryFactory.CyptFactory.CancelPartOrder(list);
        }

        public DataSet GetSupplierGradeByYear(int year)
        {
            return RepositoryFactory.CyptFactory.GetSupplierGradeByYear(year);
        }

        public DataSet GetSupplierGradeBySupplier(int year, string SupplierID)
        {
            return RepositoryFactory.CyptFactory.GetSupplierGradeBySupplier(year, SupplierID);
        }

        public DataTable GetGiveOrder(DateTime OrderDate, string SmallTypeID, string DeliveryID, string SupplierID)
        {
            return RepositoryFactory.CyptFactory.GetGiveOrder(OrderDate, SmallTypeID, DeliveryID, SupplierID);
        }

        public DataTable GetGiveOrderForBJ(DateTime OrderDate, string SmallTypeID, string DeliveryID, string SupplierID)
        {
            return RepositoryFactory.CyptFactory.GetGiveOrderForBJ(OrderDate, SmallTypeID, DeliveryID, SupplierID);
        }

        public DataSet Ces_Pro_GetSupplierPriceListForGive(string PriceSheetID, string BigTypeID, string KeyLike)
        {
            return RepositoryFactory.CyptFactory.Ces_Pro_GetSupplierPriceListForGive(PriceSheetID, BigTypeID, KeyLike);

        }

        public bool GiveOrderDetailSupplierConfirm(List<MyOrder_Detail> list)
        {
            return RepositoryFactory.CyptFactory.GiveOrderDetailSupplierConfirm(list);
        }

        public DataTable GetSupplierRate(DateTime BeginDate, DateTime EndDate, string SupplierId)
        {
            return RepositoryFactory.CyptFactory.GetSupplierRate(BeginDate, EndDate, SupplierId);
        }

        public DataTable Ces_Pro_GetDeliveryDayTotal(DateTime st, DateTime et, string DeliveryID)
        {
            return RepositoryFactory.CyptFactory.Ces_Pro_GetDeliveryDayTotal(st, et, DeliveryID);
        }

        public DataSet Ces_Pro_GetDeliveryDayTotalPro(DateTime st, DateTime et, string DeliveryID)
        {
            return RepositoryFactory.CyptFactory.Ces_Pro_GetDeliveryDayTotalPro(st, et, DeliveryID);
        }

        public DataSet Ces_Pro_GetSupplierDayTotalPro(DateTime st, DateTime et, string SupplierID)
        {
            return RepositoryFactory.CyptFactory.Ces_Pro_GetSupplierDayTotalPro(st, et, SupplierID);
        }

        public DataSet Ces_Pro_GetAllDeliveryDayTotalPro(DateTime st, DateTime et)
        {
            return RepositoryFactory.CyptFactory.Ces_Pro_GetAllDeliveryDayTotalPro(st, et);
        }

       

        public DataSet Ces_Pro_GetAllDeliveryWithSupplierTotal(DateTime st, DateTime et)
        {
            return RepositoryFactory.CyptFactory.Ces_Pro_GetAllDeliveryWithSupplierTotal(st, et);
        }

        public DataTable Ces_Pro_GetDeliveryStockMonth(string DeliveryID, int LastMonthEnd, int ThisMonthBegin, int ThisMonthEnd)
        {
            return RepositoryFactory.CyptFactory.Ces_Pro_GetDeliveryStockMonth(DeliveryID, LastMonthEnd, ThisMonthBegin, ThisMonthEnd);
        }

        public DataTable GetCes_Pro_GetPriceSheetGoodsBySupplier(string PriceSheetID, string SupplierID, string BigTypeID, string KeyLike)
        {
            return RepositoryFactory.CyptFactory.GetCes_Pro_GetPriceSheetGoodsBySupplier(PriceSheetID, SupplierID, BigTypeID, KeyLike);
        }

        public bool Ces_Pro_ChangeTrainningMod()
        {
            return RepositoryFactory.CyptFactory.Ces_Pro_ChangeTrainningMod();
        }
    }
}