Beispiel #1
0
 /// <summary>
 /// 获取核单列表
 /// </summary>
 /// <param name="order_code"></param>
 /// <returns></returns>
 public List <Model.M_CheckOrderInfo.Return> CheckOrderInfo(string order_code)
 {
     return(Common.Config.StartSqlSugar <List <Model.M_CheckOrderInfo.Return> >((db) =>
     {
         return db.Queryable <pmw_billcode, pmw_order>((a, b) => new object[]
         {
             JoinType.Left,
             a.order_code == b.order_code
         })
         .Where(a => a.order_code == order_code && SqlFunc.IsNullToInt(a.is_packed) == 0 && (SqlFunc.IsNullToInt(a.is_lock) == 0 || SqlFunc.IsNullToInt(a.is_lock) == 2) && SqlFunc.IsNullToInt(a.is_apply) == 1 && SqlFunc.IsNullToInt(a.lost_flag) == 0 && SqlFunc.IsNullToInt(a.confirm_order) == 1 && SqlFunc.IsNullToInt(a.is_outplace) == 1)
         .Select <Model.M_CheckOrderInfo.Return>((a, b) => new Model.M_CheckOrderInfo.Return
         {
             kd_billcode = a.kd_billcode,
             goods = a.goods,
             kd_com = a.kd_com,
             username = a.username,
             OrderWeight = a.dd_weight.ToString(),
             dd_size = a.dd_size,
             isSensitive = a.goodsTyep,
             is_lock = SqlFunc.ToInt32(a.is_lock),
             stockArea = a.stock_area,
             OrderId = b.id,
             cforhm = b.cforhmType,
             CForHMCusCode = b.CForHMCusCode,
             country_id = SqlFunc.ToInt32(b.country_id)
         }).ToList();
     }));
 }
Beispiel #2
0
 /// <summary>
 /// 上架/盘点
 /// 执行事务更新
 /// </summary>
 /// <param name="S"></param>
 /// <returns></returns>
 public bool ExecuteInplace(Model.M_inplaceRequest S)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Ado.UseTran(() =>
         {
             db.Insertable <tab_inplace>(new tab_inplace
             {
                 wavehouse = S.wavehouse_name,
                 billcode = S.billcode,
                 place_code = S.place_code.ToUpper(),
                 emp = S.emp,
                 create_type = S.in_type,
                 create_time = DateTime.Now
             })
             .ExecuteCommand();
             db.Updateable <pmw_billcode>(new
             {
                 stock_area = S.place_code.ToUpper(),
                 is_inplace = 1,
                 inplace_time = DateTime.Now,
                 inplace_emp = S.emp
             })
             .Where(a => a.kd_billcode == S.billcode && SqlFunc.IsNullToInt(a.is_dd) == 1)
             .ExecuteCommand();
         }).IsSuccess;
     }));
 }
Beispiel #3
0
 /// <summary>
 /// 订单已经下架
 /// </summary>
 /// <param name="out_barcode"></param>
 /// <returns></returns>
 public bool AlreadyOutOrder(string out_barcode)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Queryable <pmw_order>()
         .Any(a => a.order_code == out_barcode && SqlFunc.IsNullToInt(a.is_outplace) == 1);
     }));
 }
Beispiel #4
0
 /// <summary>
 /// 订单里的快递单未完全下架
 /// </summary>
 /// <param name="out_barcode"></param>
 /// <returns></returns>
 public bool OrderNotOutBillcode(string out_barcode)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Queryable <pmw_billcode>()
         .Any(a => a.order_code == out_barcode && SqlFunc.IsNullToInt(a.is_outplace) == 0);
     }));
 }
 /// <summary>
 /// 快递单号已下架
 /// </summary>
 /// <param name="kd_billcode"></param>
 /// <returns></returns>
 public bool IsBillcodeOut(string kd_billcode)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Queryable <pmw_billcode>()
         .Any(a => a.kd_billcode == kd_billcode && SqlFunc.IsNullToInt(a.is_outplace) == 1);
     }));
 }
Beispiel #6
0
 /// <summary>
 /// 是否存在没有打包的
 /// </summary>
 /// <param name="order_code"></param>
 /// <returns></returns>
 public bool IsOutBillcodeCount(string order_code)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Queryable <pmw_billcode>()
         .Any(a => SqlFunc.IsNullToInt(a.is_packed) == 0 && SqlFunc.IsNullOrEmpty(a.packed_billcode));
     }));
 }
Beispiel #7
0
 /// <summary>
 /// 订单未审单
 /// </summary>
 /// <param name="order_code"></param>
 /// <returns></returns>
 public bool IsOrderAudit(string order_code)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Queryable <pmw_order>()
         .Any(a => a.order_code == order_code && SqlFunc.IsNullToInt(a.DoubleCheck) == 0);
     }));
 }
Beispiel #8
0
 /// <summary>
 /// 快递单号被锁单
 /// </summary>
 /// <param name="billCode"></param>
 /// <returns></returns>
 public bool IsLockOrder(string billCode)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Queryable <pmw_billcode>()
         .Any(a => a.kd_billcode == billCode && SqlFunc.IsNullToInt(a.is_lock) == 1);
     }));
 }
 /// <summary>
 /// 检验国家ID是否存在
 /// </summary>
 /// <param name="countryID"></param>
 /// <returns></returns>
 public bool NationalInspection(int countryID)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Queryable <pmw_country>()
         .Any(a => SqlFunc.IsNullToInt(a.country_id) == countryID);
     }));
 }
 /// <summary>
 /// 获取未完成拣货的任务
 /// </summary>
 /// <param name="S"></param>
 /// <returns></returns>
 public pmw_order IsPicking(Model.M_OffShelf.OffShelfRequest S)
 {
     return(Common.Config.StartSqlSugar <pmw_order>((db) =>
     {
         return db.Queryable <pmw_order>()
         .Where(a => SqlFunc.IsNullToInt(a.is_task) == 1 && a.taskName == S.Operator)
         .First();
     }));
 }
Beispiel #11
0
 /// <summary>
 /// 单号已发货
 /// </summary>
 /// <param name="S"></param>
 /// <returns></returns>
 public bool inplaceSendOut(Model.M_inplaceRequest S)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Queryable <pmw_billcode>()
         .Where(a => a.kd_billcode == S.billcode && SqlFunc.IsNullToInt(a.is_senttohk) == 1)
         .Any();
     }));
 }
Beispiel #12
0
 /// <summary>
 /// 返回剩余单号数量
 /// </summary>
 /// <param name="ForwardingID"></param>
 /// <returns></returns>
 public int getForwardingAgentNoCount(long ForwardingID)
 {
     return(Common.Config.StartSqlSugar <int>((db) =>
     {
         return db.Queryable <Forwarder_number>()
         .Where(a => SqlFunc.IsNullToInt(a.is_Use) == 0 && a.ForwarderID == ForwardingID)
         .Count();
     }));
 }
 /// <summary>
 /// 快递没有下架
 /// </summary>
 /// <param name="orderID"></param>
 /// <returns></returns>
 public bool IsOutBillCode(long orderID)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Queryable <pmw_billcode, pmw_order>((a, b) => new object[]
         {
             JoinType.Left, a.order_code == b.order_code
         })
         .Where((a, b) => SqlFunc.IsNullToInt(a.is_outplace) == 0)
         .Where((a, b) => b.id == orderID)
         .Any();
     }));
 }
Beispiel #14
0
 /// <summary>
 /// 没有有入库记录
 /// </summary>
 /// <param name="S"></param>
 /// <returns></returns>
 public bool inplaceRecord(Model.M_inplaceRequest S)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Queryable <pmw_billcode, tab_filter>((a, b) => new object[]
         {
             JoinType.Left,
             a.kd_billcode == b.kd_billcode
         })
         .Where((a, b) => SqlFunc.IsNullToInt(a.is_dd) == 1 && a.kd_billcode == S.billcode && SqlFunc.IsNullOrEmpty(b.kd_billcode))
         .Any();
     }));
 }
 /// <summary>
 /// 根订单ID拣货
 /// </summary>
 /// <param name="orderID"></param>
 /// <param name="site"></param>
 /// <returns></returns>
 public pmw_order OrderIDGetTask(long orderID, string site)
 {
     return(Common.Config.StartSqlSugar <pmw_order>((db) =>
     {
         return db.Queryable <pmw_order, pmw_billcode>((a, b) => new object[]
         {
             JoinType.Left, a.order_code == b.order_code
         })
         .Where((a, b) => SqlFunc.IsNullToInt(a.is_outplace) == 0 && SqlFunc.IsNullToInt(a.DoubleCheck) == 1 && a.id == orderID)
         .Where((a, b) => SqlFunc.IsNullToInt(b.is_outplace) == 0 && b.wavehouse == site)
         .OrderBy(a => a.order_time, OrderByType.Asc)
         .First();
     }));
 }
 /// <summary>
 /// 订单已下架,商品未完全下架
 /// </summary>
 /// <param name="orderID"></param>
 /// <returns></returns>
 public bool OrderOutBillCodeNotOut(long orderID)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Queryable <pmw_order, pmw_billcode>((a, b) => new object[]
         {
             JoinType.Left,
             a.order_code == b.order_code
         })
         .Where((a, b) => a.id == orderID && SqlFunc.IsNullToInt(a.DoubleCheck) == 1 && SqlFunc.IsNullToInt(a.is_outplace) == 1)
         .Where((a, b) => SqlFunc.IsNullToInt(b.is_outplace) == 0)
         .Any();
     }));
 }
 /// <summary>
 /// 执行下架
 /// </summary>
 /// <param name="kd_billcode"></param>
 /// <param name="scan_emp"></param>
 /// <returns></returns>
 public bool ExecuteBillCodeOut(String kd_billcode, string scan_emp)
 {
     return(Common.Config.StartSqlSugar <bool>((db) =>
     {
         return db.Updateable <pmw_billcode>()
         .UpdateColumns(a => new pmw_billcode()
         {
             is_outplace = 1,
             outplace_time = DateTime.Now,
             outplace_emp = scan_emp,
             is_lock = 0
         })
         .Where(a => a.kd_billcode == kd_billcode && SqlFunc.IsNullToInt(a.is_inplace) == 1)
         .ExecuteCommand() > 0;
     }));
 }
 /// <summary>
 /// 按区域拣货
 /// </summary>
 /// <param name="S"></param>
 /// <param name="areaCode"></param>
 /// <returns></returns>
 public pmw_order RegionalPicking(String[] shopNameArray, string site, string areaCode)
 {
     return(Common.Config.StartSqlSugar <pmw_order>((db) =>
     {
         return db.Queryable <pmw_order, pmw_billcode, pmw_wavehouse, pmw_member>((a, b, c, d) => new object[]
         {
             JoinType.Left, a.order_code == b.order_code,
             JoinType.Left, b.stock_area == c.wavehouse_place_name,
             JoinType.Left, a.member_id == d.id
         })
         .Where((a, b, c, d) => SqlFunc.IsNullToInt(a.DoubleCheck) == 1 && SqlFunc.IsNullToInt(a.is_payed) == 1 && SqlFunc.IsNullToInt(a.is_outplace) == 0 && SqlFunc.IsNullToInt(a.Abnormal) == 0 && SqlFunc.IsNullToInt(a.is_task) == 0 && SqlFunc.HasValue(a.order_code))
         .Where((a, b, c, d) => SqlFunc.IsNullToInt(b.is_outplace) == 0 && SqlFunc.IsNullToInt(b.is_inplace) == 1 && b.wavehouse == site)
         .Where((a, b, c, d) => c.wavehouse_bigarea_name == areaCode)
         .Where((a, b, c, d) => SqlFunc.ContainsArray(shopNameArray, d.astro))
         .First();
     }));
 }
Beispiel #19
0
 /// <summary>
 /// 返回异常订单列表
 /// </summary>
 /// <param name="site"></param>
 /// <returns></returns>
 public List <Model.M_AbnormalPicking.Return> AbnormalPickingList(string site)
 {
     return(Common.Config.StartSqlSugar <List <Model.M_AbnormalPicking.Return> >((db) =>
     {
         return db.Queryable <pmw_order, pmw_billcode>((a, b) => new object[]
         {
             JoinType.Left,
             a.order_code == b.order_code
         })
         .Where((a, b) => SqlFunc.IsNullToInt(a.Abnormal) == 1 && SqlFunc.IsNullToInt(a.is_outplace) == 0)
         .Where((a, b) => SqlFunc.IsNullToInt(b.is_outplace) == 0 && b.wavehouse == site)
         .GroupBy(a => a.id)
         .GroupBy(a => a.Operator)
         .Select <Model.M_AbnormalPicking.Return>((a, b) => new Model.M_AbnormalPicking.Return
         {
             AbnormalEmp = a.Operator,
             billcode = a.id.ToString()
         }).ToList();
     }));
 }
Beispiel #20
0
 public Model.LoginMode.LoginReturn Login(string userName, string password)
 {
     return(Common.Config.StartSqlSugar <Model.LoginMode.LoginReturn>((db) =>
     {
         return db.Queryable <pmw_admin, pmw_house>((a, b) => new object[]
         {
             JoinType.Left, a.houseid == b.id
         })
         .Where((a, b) => a.username == userName && a.password == password)
         .Select <Model.LoginMode.LoginReturn>((a, b) => new Model.LoginMode.LoginReturn()
         {
             username = a.username,
             nickname = a.nickname,
             permission = SqlFunc.IsNullToInt(a.permission),
             areaCode = a.areaCode,
             PDA_role = a.PDA_role,
             house_name = b.house_name,
             houseid = a.houseid.ToString(),
             house_type = b.house_type
         }).First();
     }));
 }
Beispiel #21
0
 /// <summary>
 /// 获取打印号信息
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Forwarder_number getPrintNo(long id)
 {
     lock (lockQueryNo)
     {
         return(Common.Config.StartSqlSugar <Forwarder_number>((db) =>
         {
             return db.Ado.UseTran <Forwarder_number>(() =>
             {
                 var forderInfo = db.Queryable <Forwarder_number>()
                                  .Where(a => a.ForwarderID == id && SqlFunc.IsNullToInt(a.is_Use) == 0)
                                  .OrderBy(a => a.num)
                                  .First();
                 db.Updateable <Forwarder_number>(new
                 {
                     is_Use = 1
                 })
                 .Where(a => a.ForwarderID == id && a.num == forderInfo.num)
                 .ExecuteCommand();
                 return forderInfo;
             }).Data;
         }));
     }
 }
 public List <Model.M_AbnormalPickingList.Return> AbnormalPickingList(string out_barcode)
 {
     return(Common.Config.StartSqlSugar <List <Model.M_AbnormalPickingList.Return> >((db) =>
     {
         return db.Queryable <pmw_billcode, pmw_order>((a, b) => new object[]
         {
             JoinType.Left,
             a.order_code == b.order_code
         })
         .Where((a, b) => b.id == SqlFunc.ToInt64(out_barcode))
         .Where(a => SqlFunc.IsNullToInt(a.is_outplace) == 0)
         .Select <Model.M_AbnormalPickingList.Return>(a => new Model.M_AbnormalPickingList.Return
         {
             kd_billcode = a.kd_billcode,
             stock_area = a.stock_area,
             guige = a.dd_size,
             dd_weight2 = SqlFunc.ToDouble(a.dd_weight),
             username = a.username,
             is_inplace = SqlFunc.ToInt32(a.is_inplace),
             number = SqlFunc.ToInt32(a.number)
         }).ToList();
     }));
 }
 /// <summary>
 /// 获取拣货任务
 /// </summary>
 /// <param name="S"></param>
 /// <param name="O"></param>
 /// <returns></returns>
 public List <Model.M_OffShelf.OffShelfRuturn> PickingTask(string operatorName, string site, Model.LBTable.pmw_order O)
 {
     return(Common.Config.StartSqlSugar <List <Model.M_OffShelf.OffShelfRuturn> >((db) =>
     {
         return db.Queryable <pmw_order, pmw_billcode>((a, b) => new object[]
         {
             JoinType.Left, a.order_code == b.order_code
         })
         .Where((a, b) => a.order_code == O.order_code && SqlFunc.IsNullToInt(a.is_task) == 1 && a.taskName == operatorName && SqlFunc.IsNullToInt(a.is_outplace) == 0 && b.wavehouse == site && SqlFunc.IsNullToInt(b.is_outplace) == 0)
         .OrderBy((a, b) => b.stock_area)
         .Select((a, b) => new Model.M_OffShelf.OffShelfRuturn
         {
             OrderId = a.id,
             out_barcode = a.order_code,
             username = a.cus,
             kd_billcode = b.kd_billcode,
             stock_area = b.stock_area,
             dd_weight2 = b.dd_weight.ToString(),
             guige = b.dd_size,
             is_inplace = b.is_inplace.ToString(),
             number = b.number.ToString()
         }).ToList();
     }));
 }
Beispiel #24
0
        /// <summary>
        /// 记录打单数据
        /// </summary>
        /// <param name="orderInfo"></param>
        /// <param name="orderSentBillCode"></param>
        /// <param name="orderSentCompany"></param>
        /// <param name="recipients"></param>
        /// <param name="houserInfo"></param>
        /// <param name="tbInfo"></param>
        /// <param name="forwarderInfo"></param>
        /// <param name="billCoderList"></param>
        /// <param name="goodsName"></param>
        /// <param name="S"></param>
        /// <param name="printNo"></param>
        /// <returns></returns>
        public bool Print(decimal collectingMoney, pmw_order orderInfo, string orderSentBillCode, string orderSentCompany, string recipients, pmw_house houserInfo, TaoBaoInfo tbInfo, Forwarder forwarderInfo, string[] billCoderList, string goodsName, Model.M_Print.Request S, string printNo, double weightBillcode)
        {
            return(Common.Config.StartSqlSugar <bool>((db) =>
            {
                return db.Ado.UseTran(() =>
                {
                    db.Insertable <pmw_Print>(new pmw_Print
                    {
                        address = orderInfo.address,
                        orderID = orderInfo.id,
                        operateMan = S.operateMan,
                        operateSiteID = SqlFunc.ToInt32(S.operateSite),
                        operateTime = DateTime.Now,
                        WaybillNo = printNo,
                        z_weight = SqlFunc.ToDecimal(weightBillcode)
                    }).ExecuteCommand();
                    db.Insertable <pmw_track>(new pmw_track
                    {
                        billcode = printNo,
                        scan_time = DateTime.Now,
                        scan_type = "拣货完成",
                        scan_memo = "拣货完毕,快件已拣货完毕,正在打包",
                        scan_site = houserInfo.house_name,
                        scan_emp = S.operateMan
                    }).ExecuteCommand();

                    db.Updateable <pmw_billcode>(new
                    {
                        is_packed = 1,
                        packed_time = DateTime.Now,
                        packed_emp = S.operateMan,
                        packed_billcode = printNo,
                        packed_code = forwarderInfo.ForwarderCode,
                        packed_kd_com = forwarderInfo.ForwarderName,
                        printID = forwarderInfo.id,
                        is_Big = S.is_Big
                    })
                    .Where(a => SqlFunc.ContainsArray(billCoderList, a.kd_billcode) && a.order_code == orderInfo.order_code && (SqlFunc.IsNullToInt(a.is_lock) == 0 || SqlFunc.IsNullToInt(a.is_lock) == 2))
                    .ExecuteCommand();

                    db.Updateable <pmw_order>(new
                    {
                        is_sented = 1,
                        sent_emp = S.operateMan,
                        sent_time = DateTime.Now,
                        sent_kd_billcode = orderSentBillCode,
                        sent_kd_com = orderSentCompany
                    })
                    .Where(a => a.id == orderInfo.id)
                    .ExecuteCommand();

                    db.Insertable <CFHMPring>(new CFHMPring
                    {
                        CForHM_number = printNo,
                        OrderID = orderInfo.id,
                        freightPayable = collectingMoney,
                        goods = goodsName.ToString(),
                        recipients = recipients,
                        consignee = recipients,
                        recipientsAdd = orderInfo.address,
                        recipientsPhone = orderInfo.mobile,
                        recipientsIDCard = orderInfo.RecipientCode,
                        TurnNumber = billCoderList.Length,
                        Order_Notes = orderInfo.order_memo,
                        consolidator = tbInfo.Name,
                        deliveryCom = forwarderInfo.ForwarderName,
                        deliveryCode = forwarderInfo.ForwarderCode,
                        billNumType = "PDA",
                        CFpacked_time = DateTime.Now,
                        CFpacked_billcode = printNo,
                        CFpacked_code = forwarderInfo.ForwarderCode,
                        CFpacked_emp = S.operateMan,
                        CFpacked_kd_com = forwarderInfo.ForwarderName,
                        KD_billcodeList = string.Join(",", billCoderList),
                        houseID = houserInfo.id,
                        houseName = houserInfo.house_name,
                        netWeight = SqlFunc.ToDecimal(weightBillcode)
                    }).ExecuteCommand();
                }).IsSuccess;
            }));
        }