Beispiel #1
0
        /// <summary>
        /// 通过剑客编号批量查询物流
        /// </summary>
        /// <param name="JKOrderId"></param>
        /// <param name="jkLogisticsList"></param>
        /// <returns></returns>
        public bool multi_QueryLogistics(string[] JKOrderId, out string jkLogisticsList)
        {
            Dictionary <string, string> kvs = new Dictionary <string, string>();

            kvs.Add("method", "jianke.logistics.get");
            kvs.Add("cid", _tscid);
            kvs.Add("signMethod", "md5");
            kvs.Add("randomStr", Ass.Data.Utils.GetRandomString(8));
            var str = Newtonsoft.Json.JsonConvert.SerializeObject(JKOrderId).Replace("\"", "");

            kvs.Add("orderNo", str);
            var    json     = JKSign(kvs, "orderNo");
            var    netJK    = new NETDrugStore();
            string codeJson = netJK.HttpsPostDrugOrderInfo(json, _url);

            Newtonsoft.Json.Linq.JObject jobj = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(codeJson);
            var rtnCode = jobj.GetValueString("returnCode", "code");

            if (rtnCode == "SUCCESS")
            {
                jkLogisticsList = jobj.GetValue("mapList")[0].GetValueString("orderNo");
                return(true);
            }
            else
            {
                throw new Exception("三方返回错误信息:[" + rtnCode + "]" + jobj.GetValueString("returnMsg", "message"));
            }
        }
Beispiel #2
0
        /// <summary>
        /// 虚拟库存查询
        /// </summary>
        /// <param name="ThreePartDrugId"></param>
        /// <param name="qyt"></param>
        /// <returns></returns>
        public bool CheckDrugIsAvaliableReal(string ThreePartDrugId /*, out int qyt*/)
        {
            var warehouse = new string[2];
            //todo 验证健客的药品是否可用
            Dictionary <string, string> kvs = new Dictionary <string, string>();

            kvs.Add("method", "jianke.stock.getReal");
            kvs.Add("signMethod", "md5");
            kvs.Add("cid", _tscid);
            kvs.Add("randomStr", Ass.Data.Utils.GetRandomString(8));
            //仓库
            warehouse[0] = "1";
            warehouse[1] = "4";
            var warehouseCode = Newtonsoft.Json.JsonConvert.SerializeObject(warehouse).Replace("\"", "");

            kvs.Add("warehouseCode", warehouseCode);
            var productIdStr = new string[1];

            productIdStr[0] = ThreePartDrugId;
            var str = Newtonsoft.Json.JsonConvert.SerializeObject(productIdStr).Replace("\"", "");

            kvs.Add("productCode", str);
            var json = JKSign(kvs, "productCode", "warehouseCode");

            if (json == "")
            {
                throw new Exception("没有数据可查询!");
            }
            //药品list集合productCode
            var    netJK    = new NETDrugStore();
            string codeJson = netJK.HttpsPostDrugOrderInfo(json, _url);

            Newtonsoft.Json.Linq.JObject jobj = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(codeJson);
            var rtnCode = jobj.GetValueString("returnCode", "code");

            if (rtnCode == "SUCCESS")
            {
                var numStr = jobj.GetValueString("quantity");
                int num    = Convert.ToInt32(numStr);
                //qyt = num;
                if (num <= 0)
                {
                    throw new Exception("该药品没有库存");
                }
                if (num <= 6)
                {
                    throw new Exception("库存紧张");
                }
                return(true);
            }
            else
            {
                throw new Exception("三方返回错误信息:[" + rtnCode + "]" + jobj.GetValueString("returnMsg", "message"));
            }
        }
Beispiel #3
0
        /// <summary>
        /// 获取药品的基本信息
        /// </summary>
        /// <param name="threePartDrugId">第三方药品的Id</param>

        public CHIS.Models.DataModels.DrugInfo QueryDrugInfo(int threePartDrugId)
        {
            Dictionary <string, string> kvs = new Dictionary <string, string>();

            kvs.Add("method", "jianke.product.get");
            kvs.Add("signMethod", "md5");
            kvs.Add("cid", _tscid);
            kvs.Add("randomStr", Ass.Data.Utils.GetRandomString(8));
            //string[] productIdStr = new string[1];
            //productIdStr[0] = threePartDrugId.ToString();
            //var str = Newtonsoft.Json.JsonConvert.SerializeObject(productIdStr).Replace("\"", "");
            //kvs.Add("productCode", str);
            kvs.Add("productCode", threePartDrugId.ToString());
            var json = JKSign(kvs, "productCode");

            if (json == "")
            {
                throw new Exception("没有数据可查询!");
            }
            //药品list集合productCode
            var    netJK    = new NETDrugStore();
            string codeJson = netJK.HttpsPostDrugOrderInfo(json, _url);

            Newtonsoft.Json.Linq.JObject jobj = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(codeJson);
            var rtnCode = jobj.GetValueString("returnCode", "code");

            if (rtnCode == "SUCCESS")
            {
                var item = jobj.GetValue("productList")[0];
                return(new CHIS.Models.DataModels.DrugInfo
                {
                    productCode = item.GetValueString("productCode"),
                    productName = item.GetValueString("productName"),
                    mainProductCode = item.GetValueString("mainProductCode"),
                    productStatusType = Ass.P.PIntV(item.GetValueString("productStatusType"), 0),
                    marketPrice = Ass.P.PIntV(item.GetValueString("marketPrice"), 9999),
                    ourPrice = Ass.P.PIntV(item.GetValueString("ourPrice"), 9999),
                    manufacturer = item.GetValueString("manufacturer"),
                    prescriptionType = item.GetValueString("prescriptionType"),
                    productInventory = Ass.P.PIntV(item.GetValueString("productInventory"), 0),
                    productAttribute = item.GetValueString("productAttribute"),
                    thumbnailUrl = item.GetValueString("thumbnailUrl"),
                    introduction = item.GetValueString("introduction"),
                    packing = item.GetValueString("packing")
                });
            }
            else
            {
                throw new Exception("三方返回错误信息:[" + rtnCode + "]" + jobj.GetValueString("returnMsg", "message"));
            }
        }
Beispiel #4
0
        /// <summary>
        /// 检查药品是否正常可用 否则抛出错误(单个药品的库存查询,如果大于10个就可以发货)正式库存查询
        /// </summary>
        /// <param name="threePartDrugId">健客药品Id</param>
        /// <returns>true 表示可用</returns>
        public bool CheckDrugIsAvaliable(int threePartDrugId)
        {
            //todo 验证健客的药品是否可用
            Dictionary <string, string> kvs = new Dictionary <string, string>();

            kvs.Add("method", "jianke.product.get");
            kvs.Add("signMethod", "md5");
            kvs.Add("cid", _tscid);
            kvs.Add("randomStr", Ass.Data.Utils.GetRandomString(8));
            kvs.Add("productCode", threePartDrugId.ToString());
            var json = JKSign(kvs, "productCode");

            if (json == "")
            {
                throw new Exception("没有数据可查询!");
            }
            //药品list集合productCode
            var    netJK    = new NETDrugStore();
            string codeJson = netJK.HttpsPostDrugOrderInfo(json, _url);

            Newtonsoft.Json.Linq.JObject jobj = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(codeJson);
            var rtnCode = jobj.GetValueString("returnCode", "code");

            if (rtnCode == "SUCCESS")
            {
                string numStr = jobj.GetValue("productList")[0].GetValueString("productInventory");
                if (string.IsNullOrEmpty(numStr))
                {
                    throw new Exception("暂无该药品");
                }
                else
                {
                    int num = Convert.ToInt32(numStr);
                    if (num <= 0)
                    {
                        throw new Exception("该药品没有库存");
                    }
                    if (num <= 6)
                    {
                        throw new Exception("库存紧张");
                    }
                    return(true);
                }
            }
            else
            {
                throw new Exception("三方返回错误信息:[" + rtnCode + "]" + jobj.GetValueString("returnMsg", "message"));
            }
        }
Beispiel #5
0
        /// <summary>
        /// 批量产品库存查询
        /// </summary>
        /// <param name="ThreePartDrugId"></param>
        /// <returns></returns>
        public bool CheckDrugIsAvaliables(string[] ThreePartDrugIds)
        {
            //todo 验证健客的药品是否可用
            Dictionary <string, string> kvs = new Dictionary <string, string>();

            kvs.Add("method", "jianke.stock.get");
            kvs.Add("signMethod", "md5");
            kvs.Add("cid", _tscid);
            kvs.Add("randomStr", Ass.Data.Utils.GetRandomString(8));
            var strs = Newtonsoft.Json.JsonConvert.SerializeObject(ThreePartDrugIds).Replace("\"", "");

            kvs.Add("productCode", strs);
            var json = JKSign(kvs, "productCode");

            if (json == "")
            {
                throw new Exception("没有数据可查询!");
            }
            //药品list集合productCode
            var    netJK    = new NETDrugStore();
            string codeJson = netJK.HttpsPostDrugOrderInfo(json, _url);

            Newtonsoft.Json.Linq.JObject jobj = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(codeJson);
            var rtnCode = jobj.GetValueString("returnCode", "code");

            if (rtnCode == "SUCCESS")
            {
                var numStr = jobj.GetValueString("quantity");
                int num    = Convert.ToInt32(numStr);
                if (num <= 10)
                {
                    throw new Exception("库存紧张");
                }
                return(true);
            }
            else
            {
                throw new Exception("三方返回错误信息:[" + rtnCode + "]" + jobj.GetValueString("returnMsg", "message"));
            }
        }
Beispiel #6
0
        List <OrderNoList> orderList = null;//订单编号
        /// <summary>
        /// 创建剑客订单
        /// </summary>
        /// <param name="url">请求的URL</param>
        /// <param name="parameters">随同请求POST的参数名称及参数值字典</param>
        /// <param name="timeout">请求的超时时间</param>
        ///  <param methods="post">post</param>
        /// <returns></returns>
        public bool SendJKWebNetOrder(decimal totalamount, string orderId, long selectedAddressId, string sendRmk, out string FromJKSavedOrderNo)
        {
            if (_env.IsDevelopment())
            {
                sendRmk += "[测试]";
            }
            //汇总健康发送数据
            //通过订单编号查询网络发药信息视图表
            var netInf = _db.vwCHIS_Shipping_NetOrder.AsNoTracking().Where(m => m.SendOrderId == orderId).Select(m => new
            {
                orderTime  = m.CreatTime,
                netOrderId = m.NetOrderId,

                telephone      = m.Mobile,
                consignee      = m.ContactName,
                transportCosts = m.ContainTransFee,
                address        = m.AddressDetail,
            }).FirstOrDefault();
            var addrInf = _db.vwCHIS_Code_Customer_AddressInfos.AsNoTracking().FirstOrDefault(m => m.AddressId == selectedAddressId);

            Dictionary <string, string> kvs = new Dictionary <string, string>();

            kvs.Add("method", "jianke.order.externalcreate");
            kvs.Add("signMethod", "md5");
            kvs.Add("cid", _tscid);
            kvs.Add("randomStr", Ass.Data.Utils.GetRandomString(8));// Ass.Data.Utils.GetRandomString(8));
            kvs.Add("externalOrderNo", orderId);
            kvs.Add("accountId", "00000000-0000-0000-0000-000000000000");
            kvs.Add("invoice", "null");
            kvs.Add("status", "2");
            kvs.Add("deliveryZipCode", addrInf.ZipCode.ToString());
            kvs.Add("money", Ass.P.PInt(totalamount * 100).ToString());
            kvs.Add("orderTime", netInf.orderTime.ToString("yyyy-M-d H:m:s"));
            kvs.Add("paymentType", "2");                                      //默认微信支付
            kvs.Add("consignee", netInf.consignee + sendRmk.ToRoundStr('[')); //发货人的姓名
            kvs.Add("telephone", netInf.telephone);
            kvs.Add("mobilephone", netInf.telephone);
            kvs.Add("province", ComTools.GetAreaName(addrInf.MergerName, 0));
            kvs.Add("city", ComTools.GetAreaName(addrInf.MergerName, 1));
            kvs.Add("district", ComTools.GetAreaName(addrInf.MergerName, 2));
            kvs.Add("town", "");
            kvs.Add("address", netInf.address);
            kvs.Add("transportCosts", Ass.P.PInt((netInf.transportCosts ?? 0) * 100).ToString());//物流费
            var drugList = _db.vwCHIS_Shipping_NetOrder_Formed_Detail.Where(m => m.NetOrderId == netInf.netOrderId).AsNoTracking().ToList().Select(m => new
                                                                                                                                                   OrderProduct
            {
                productCode = m.ThreePartDrugId.ToString().Replace(" ", ""),
                productName = m.DrugName.ToString().Replace(" ", ""),
                amount      = Ass.P.PInt(m.Qty),
                actualPrice = Ass.P.PInt(m.Price * 100),
                packing     = m.DrugModel
            }
                                                                                                                                                   ).ToList();
            var    json     = JKSign(kvs, drugList);
            var    netJK    = new NETDrugStore();
            string codeJson = netJK.HttpsPostDrugOrderInfo(json, _url);

            Newtonsoft.Json.Linq.JObject jobj = (Newtonsoft.Json.Linq.JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(codeJson);
            var rtnCode = jobj.GetValueString("returnCode", "code");

            if (rtnCode == "SUCCESS")
            {
                FromJKSavedOrderNo = jobj.GetValueString("orderNo");
                return(true);
            }
            else
            {
                throw new Exception("三方返回错误信息:[" + rtnCode + "]" + jobj.GetValueString("returnMsg", "message"));
            }
        }