Ejemplo n.º 1
0
 public string loadExceptionExpress()
 {
     if (3 == uiData.UserType)
     {
         return(loadExceptionExpress(uiData.PBoxInfo.PBCRTNO));
     }
     else if (4 == uiData.UserType)
     {
         var userInfo      = JsonHelper.ToObject(JsonHelper.ToJson(uiData.UserInfo));
         var onelevelorgid = userInfo["userInfo"].Value <int>("onelevelorgid");
         return(loadExceptionExpress(onelevelorgid.ToString(), uiData.PBoxInfo.PBCRTNO));
     }
     return("");
 }
Ejemplo n.º 2
0
 public string loadUserExpress()
 {
     LogHelper.Log("loadUserExpress:uiData.UserType = " + uiData.UserType);
     generateException();
     if (3 == uiData.UserType)
     {
         return(loadUserExpress(uiData.PBoxInfo.PBCRTNO));
     }
     else if (4 == uiData.UserType)
     {
         var userInfo      = JsonHelper.ToObject(JsonHelper.ToJson(uiData.UserInfo));
         var onelevelorgid = userInfo["userInfo"].Value <int>("uiDeptId");
         return(loadUserExpress(onelevelorgid.ToString(), uiData.PBoxInfo.PBCRTNO));
     }
     return("");
 }
Ejemplo n.º 3
0
        public string validateMoney()
        {
            var   userInfo         = JsonHelper.ToObject(JsonHelper.ToJson(uiData.UserInfo));
            float accountMoney     = userInfo["userAccount"].Value <float>("uaCurrActMoney");
            var   ciId             = userInfo["userInfo"].Value <string>("ciId");
            var   r                = service.queryMoney(ciId);
            var   obj              = JsonHelper.ToObject(JsonHelper.ToJson(r));
            float currAccountMoney = obj.Value <float>("uaCurrActMoney");

            if ((accountMoney + uiData.MemberAccount) <= currAccountMoney && currAccountMoney > 0)
            {
                return(JsonHelper.ToJson(new { success = true }));
            }
            else
            {
                return(JsonHelper.ToJson(new { success = false }));
            }
            //var result = JToken.FromObject(false);
            //obj.TryGetValue("uaCurrActMoney", out result);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 管理员修改格口状态从使用到空闲时,释放当前格口内所有快件
        /// </summary>
        /// <param name="moNo"></param>
        public void releaseExpress(string moNo)
        {
            var sql          = @"              select 
                    ei.ei_id as eiId,
                    ei.ei_storeUserName as eiStoreUserName,
                    ei.ei_storeUserPhone as eiStoreUserPhone,
                    ei.EI_BARCODE as eiBarcode,
                    ei.EI_ORDERNO as eiOrderNo,
                    ei.tf_buzStatus as tfBuzStatus,
                    ei.ei_latticeNo as eiLatticeNo,
                    ei.EI_LCID as eiLcId
                    from ebox_expresinfo ei 
                    where ei.tf_deleteFlag=0
                    and ei.tf_buzStatus in (3,5,7)
                    and ei.ei_latticeNo={0}
                    and ei.ei_eboxNo={1}
                    ";
            var userInfo     = JsonHelper.ToObject(JsonHelper.ToJson(uiData.UserInfo));
            var userId       = userInfo["userInfo"].Value <string>("uiId");
            var uaUserIdCode = userInfo["userInfo"].Value <string>("uiUserIdCode");
            var uaUserIdType = userInfo["userInfo"].Value <string>("uiUserIdType");
            var eboxNo       = Setting.Instance.BoxNo;
            var eboxId       = Setting.Instance.BoxID;
            var expressList  = localData.Query <ExpressList>(sql, moNo, eboxNo);

            if (null != expressList)
            {
                foreach (var e in expressList)
                {
                    var rst = service.administratorToTake(eboxId, eboxNo, e.eiOrderNo.ToString(),
                                                          userId.ToString(), e.tfBuzStatus.ToString(), e.eiLcId.ToString(),
                                                          uaUserIdType.ToString(), uaUserIdCode.ToString(), e.eiLatticeNo.ToString());
                    if (null != rst && rst.ToString() == "-1")
                    {
                        localData.finishExpressBuz(Convert.ToInt32(e.eiId), Convert.ToInt32(e.tfBuzStatus) + 1);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 快递员、管理员取件完成后调用
        /// </summary>
        public void finishGetExpress(string eiId)
        {
            LogHelper.Log("finishGetExpress:uiData.UserType = " + uiData.UserType + ",eboxOrderNo:" + eiId);
            var expressList = localData.QueryExpresses(eiId);

            switch (uiData.UserType)
            {
            //3是管理员
            case 3:
            {
                var userInfo     = JsonHelper.ToObject(JsonHelper.ToJson(uiData.UserInfo));
                var userId       = userInfo["userInfo"].Value <string>("uiId");
                var uaUserIdType = "";
                var uaUserIdCode = "";
                var ids          = uiData.ExpressIdList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(c => Convert.ToInt32(c));
                foreach (var e in expressList)
                {
                    var rst = service.administratorToTake(e.EIEBOXID.ToString(), e.EIEBOXNO, e.EIORDERNO,
                                                          userId.ToString(), "" + e.TFBUZSTATUS, e.EILCID.ToString(),
                                                          uaUserIdType.ToString(), uaUserIdCode.ToString(), e.EILATTICENO);
                    LogHelper.Log("KuaiDiYuan:rst = " + rst);
                    if (rst.ToString() == "-1")
                    {
                        localData.freeMouthArkState(e.EILATTICENO, e.EIEBOXNO);

                        localData.finishExpressBuz(e.EIID, e.TFBUZSTATUS + 1);
                    }
                }
                break;
            }

            //userType=4是快递员
            case 4:
            {
                var userInfo     = JsonHelper.ToObject(JsonHelper.ToJson(uiData.UserInfo));
                var userId       = userInfo["userInfo"].Value <string>("uiId");
                var uaUserIdCode = userInfo["userAccount"].Value <string>("uaUserIdCode");
                var uaUserIdType = userInfo["userAccount"].Value <string>("uaUserIdType");
                var ids          = uiData.ExpressIdList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(c => Convert.ToInt32(c));
                foreach (var e in expressList)
                {
                    // var ark = localData.GetMouthArkByBoxNo(e.EILATTICENO);
                    if (e.EIMAILTYPE == 2)
                    {
                        var rst = service.courierTakeSend(e.EIEBOXID.ToString(), e.EIEBOXNO, e.EIORDERNO,
                                                          userId.ToString(), "3", e.EILCID.ToString(),
                                                          uaUserIdType.ToString(), uaUserIdCode.ToString(), e.EILATTICENO);
                        if (rst.ToString() == "-1")
                        {
                            localData.freeMouthArkState(e.EILATTICENO, e.EIEBOXNO);
                            localData.finishExpressBuz(e.EIID, 4);
                        }
                    }

                    else
                    {
                        var rst = service.expressTakeAbnormal(e.EIEBOXID.ToString(), e.EIEBOXNO, e.EIORDERNO,
                                                              userId.ToString(), "" + e.TFBUZSTATUS, e.EILCID.ToString(),
                                                              uaUserIdType.ToString(), uaUserIdCode.ToString(), e.EILATTICENO);
                        if (rst.ToString() == "-1")
                        {
                            localData.freeMouthArkState(e.EILATTICENO, e.EIEBOXNO);
                            localData.finishExpressBuz(e.EIID, e.TFBUZSTATUS + 1);
                        }
                    }
                }
                break;
            }

            default:
                break;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// money用户需要补的钱
        /// selectNo用户补钱的原因
        ///1.超重 2.修理 3.有冷气 4.干洗服务 5.其他情况
        /// </summary>
        /// <param name="money"></param>
        /// <param name="selectNo"></param>
        /// <returns></returns>

        public string saveStoreExpress(float money, int selectNo, string language)
        {
            try
            {
                var userInfo        = JsonHelper.ToObject(JsonHelper.ToJson(uiData.UserInfo));
                var onelevelorgid   = userInfo["userInfo"].Value <int>("onelevelorgid");
                var onelevelorgname = userInfo["userInfo"].Value <string>("onelevelorgname");
                var uiId            = userInfo["userInfo"].Value <int>("uiId");
                var uiUserName      = userInfo["userInfo"].Value <string>("uiUserName");
                var uiUserPhone     = userInfo["userInfo"].Value <string>("uiUserPhone");
                //var jiJianInfo = JsonHelper.ToObject(uiData.JiJianInfo);
                //var eiTakeUserId = jiJianInfo.Value<int?>("eiTakeUserId");
                //var eiTakeUserName = jiJianInfo.Value<string>("eiTakeUserName");
                //var sysId = jiJianInfo.Value<int?>("eiId");

                string expressId = "";
                var    tryTimes  = 0;
                while (tryTimes++ < 10)
                {
                    expressId = (service.expressId() ?? string.Empty).ToString();
                    if (!(string.IsNullOrEmpty(expressId) || expressId.Length < 5))
                    {
                        break;
                    }
                    Thread.Sleep(200);
                }
                if (string.IsNullOrEmpty(expressId) || expressId.Length < 5)
                {
                    throw new Exception("获取订单号失败");
                }
                // 到付件:快递员与客户都收钱|快递员存件:只有快递员收钱,快递员收钱只传格口费用
                var payModel = 0;
                if (selectNo == 1)
                {
                    DateTime DiscountEndTime = Setting.Instance.DiscountEnd;

                    if (DateTime.Compare(DateTime.Now, DiscountEndTime) > 0)
                    {
                        uiData.ExtraWeight = float.Parse((money / Setting.Instance.UnitExp) * 0.5 + "");
                    }
                    else
                    {
                        uiData.ExtraWeight = float.Parse((money / Setting.Instance.uUnitExp) * 0.5 + "");
                    }
                }
                if (money > 0 && selectNo > 0)
                {
                    payModel = 1012;
                }
                else
                {
                    payModel = 1010;
                }

                var mouthMoney = getMouthMoney(uiData.JiJianMouthNo, uiData.PBoxInfo.PBID);
                var mouthPrice = mouthMoney.ToString("0.0");

                /*
                 * if (mouthMoney > 0)
                 * {
                 *  var r = service.courierDeduction(uiId, expressId, uiData.PBoxInfo.PBID, uiData.PBoxInfo.PBCRTNO, mouthMoney);
                 *  if (r != null && r.ToString() == "-1")
                 *      localData.lockMouthArkState(uiData.JiJianMouthNo, uiData.PBoxInfo.PBID);
                 * }*/
                string rst = "-3";
                //根据barcode来判断语言
                language = uiData.JiJianBarCode.Substring(uiData.JiJianBarCode.Length - 1);
                var info = service.expressSave(uiData.JiJianBarCode, uiData.PBoxInfo.PBABBR, uiData.PBoxInfo.PBCRTNO,
                                               uiData.JiJianMouthNo, onelevelorgid, onelevelorgname, payModel, "" + money, uiId, uiUserName, uiUserPhone,
                                               null, null, uiData.JiJianPhone, null, expressId, uiData.PBoxInfo.PBID, mouthPrice, language);
                LogHelper.Log("info---------------" + info);
                if (Service.IsValidResult(info) && info.ToString() != expressId.ToString())
                {
                    bool ok        = localData.lockMouthArkState(uiData.JiJianMouthNo, uiData.PBoxInfo.PBID);
                    var  localInfo = localData.submitStoreExpress(info as JObject);
                    if (localInfo == null || !ok)
                    {
                        rst = "-2";
                    }
                    else
                    {
                        var result = new
                        {
                            barcode    = uiData.JiJianBarCode,
                            phone      = uiData.JiJianPhone,
                            moNo       = uiData.JiJianMouthNo,
                            mouthMoney = mouthPrice
                        };
                        double uaCompanyActMoney = userInfo["userAccount"].Value <double>("uaCompanyActMoney");
                        userInfo["userAccount"]["uaCompanyActMoney"] = (uaCompanyActMoney - Convert.ToDouble(mouthPrice)).ToString("0.00");
                        uiData.UserInfo = userInfo;

                        if (money > 0)
                        {
                            //说明是到付件,修改快件状态为代付款状态TF_BUZSTATUS=2
                            var order = localInfo.EIORDERNO;
                            localData.PayMoneyExpress(order, money);
                        }
                        return(JsonHelper.ToJson(result));
                    }
                }
                //发生异常后开锁,取消存件
                var ark = localData.GetMouthArkByBoxNo(uiData.JiJianMouthNo);
                if (ark != null)
                {
                    localData.freeMouthArkState(uiData.JiJianMouthNo, uiData.PBoxInfo.PBCRTNO);
                    int boardNo = -1;
                    int.TryParse(ark.MOCSANO, out boardNo);
                    boxDoor.Open(boardNo, ark.MOLOCKNO);
                }
                return(rst);
            }
            catch (Exception ex)
            {
                LogHelper.Log("保存包裹信息异常", ex);
                return("-2");
            }
        }