コード例 #1
0
ファイル: OrderLogic.cs プロジェクト: 13802057046/testGitHub
        /// <summary>
        /// 微盟-更新订单标记(ec/order/updateOrderFlag)
        /// </summary>
        public void UpdateOrderFlagToWm(DateTime startDate, DateTime endDate)
        {
            string preMsg = "微盟 更新订单标记 ";

            string    sql     = @"select a.F_BillStatus, a.F_BillID 
                        from T_OrderLogisticsInformation a ";
            DataTable dtOrder = sd.GetDataTable(sql);

            Log.WriteLog(preMsg + "取得的记录数:" + dtOrder.Rows.Count + "行。", 1);
            if (dtOrder.Rows.Count == 0)
            {
                return;
            }


            foreach (DataRow drDetail in dtOrder.Rows)
            {
                UpdateOrderFlagRequest request = new UpdateOrderFlagRequest();
                request.flagRank    = NumUtil.ToInt(drDetail["F_BillStatus"]);
                request.orderNoList = new List <string> {
                    drDetail["F_BillID"].ToString()
                };
                UpdateOrderFlagResponse response = HttpPostToWm <UpdateOrderFlagResponse>("ec/order/updateOrderFlag", request, preMsg);
            }
        }
コード例 #2
0
        /// <summary>
        /// 微盟-商品信息-批量上下架(ec/goods/updateGoodsShelfStatus)
        /// </summary>
        public void UpdateGoodsShelfStatusToWm(DateTime startDate, DateTime endDate)
        {
            string preMsg = "微盟 批量上下架 ";

            string sql = @"select a.F_ID, F_GoodsID, F_Stop
                            from v_Item_NoPic a 
                            where a.F_UpdateTime >= '" + startDate.ToString("yyyy-MM-dd HH:mm:ss") + @"'
                              and a.F_UpdateTime < '" + endDate.ToString("yyyy-MM-dd HH:mm:ss") + @"'
                              and a.F_GoodsID is not null ";

            DataTable dtItem = sd.GetDataTable(sql);

            Log.WriteLog(preMsg + "取得的记录数:" + dtItem.Rows.Count + "行。", 1);
            if (dtItem.Rows.Count == 0)
            {
                return;
            }

            foreach (DataRow drItem in dtItem.Rows)
            {
                UpdateGoodsShelfStatusRequest request = new UpdateGoodsShelfStatusRequest();

                List <long> goodsIdList = new List <long>();

                goodsIdList.Add(NumUtil.GetVal_Long(drItem["F_GoodsID"]));
                request.goodsIdList = goodsIdList;
                request.isPutAway   = NumUtil.ToInt(drItem["F_Stop"]);

                UpdateGoodsShelfStatusResponse response = HttpPostToWm <UpdateGoodsShelfStatusResponse>("ec/goods/updateGoodsShelfStatus", request, preMsg);
            }
        }
コード例 #3
0
        /// <summary>
        /// 发网>商品信息
        /// </summary>
        public void AddProductToFw(DateTime startDate, DateTime endDate)
        {
            string preMsg = "发网 商品信息 ";

            string sql = @"select a.F_BarCode, a.F_ID, a.F_Name, a.F_Unit, a.F_Safe, a.F_Spec
                            from v_Item_NoPic a 
                            where a.F_CreaterDate >= '" + startDate.ToString("yyyy-MM-dd HH:mm:ss") + @"'
                              and a.F_CreaterDate < '" + endDate.ToString("yyyy-MM-dd HH:mm:ss") + "'";

            DataTable dtItem = sd.GetDataTable(sql);

            Log.WriteLog(preMsg + "取得的记录数:" + dtItem.Rows.Count + "行。", 1);
            if (dtItem.Rows.Count == 0)
            {
                return;
            }

            WmsProductsSyncRequest             request  = new WmsProductsSyncRequest();
            WmsProductsSyncResponse            response = new WmsProductsSyncResponse();
            List <WmsProductsSyncRequest.Item> products = new List <WmsProductsSyncRequest.Item>();

            for (int i = 0; i < dtItem.Rows.Count; i++)
            {
                products.Add(new WmsProductsSyncRequest.Item()
                {
                    BarCode            = StrUtil.ConvToStr(dtItem.Rows[i]["F_BarCode"]),
                    ItemCode           = StrUtil.ConvToStr(dtItem.Rows[i]["F_ID"]),
                    ActionType         = "ADD",
                    ItemName           = StrUtil.ConvToStr(dtItem.Rows[i]["F_Name"]),
                    Unit               = StrUtil.ConvToStr(dtItem.Rows[i]["F_Unit"]),
                    AlterStorageAmount = NumUtil.ToInt(dtItem.Rows[i]["F_Safe"]),
                    PackageSpec        = StrUtil.ConvToStr(dtItem.Rows[i]["F_Spec"])
                });

                if (products.Count == 100)
                {
                    request.Items = products;
                    response      = HttpPostToFw <WmsProductsSyncResponse>(request, preMsg);
                    products.Clear();
                }
            }
            if (products.Count > 0)
            {
                request.Items = products;
                response      = HttpPostToFw <WmsProductsSyncResponse>(request, preMsg);
            }
            Log.WriteLog(preMsg + "完成。" + startDate.ToString("yyyy-MM-dd HH:mm:ss") + " ~ " + endDate.ToString("yyyy-MM-dd HH:mm:ss"), 1);
        }
コード例 #4
0
        /// <summary>
        /// 微盟-商品信息-全量更新商品库存(ec/goods/wholeUpdateStock)
        /// </summary>
        public void WholeUpdateStockToWm(DateTime startDate, DateTime endDate)
        {
            string preMsg = "微盟 全量更新商品库存 ";

            string sql = @"select a.F_GoodsID, a.F_SkuID, a.F_ID, a.F_Barcode, b.F_Qty, b.F_ShopID, b.F_StorageID
                            from v_Item_NoPic a 
                            left join t_StorageQty b on a.F_ID = b.F_ItemID and a.F_ColorID = b.F_ColorID and a.F_SizeID = b.F_SizeID 
                            where a.F_UpdateTime >= '" + startDate.ToString("yyyy-MM-dd HH:mm:ss") + @"'
                              and a.F_UpdateTime < '" + endDate.ToString("yyyy-MM-dd HH:mm:ss") + "'";

            DataTable dtItem = sd.GetDataTable(sql);

            Log.WriteLog(preMsg + "取得的记录数:" + dtItem.Rows.Count + "行。", 1);
            if (dtItem.Rows.Count == 0)
            {
                return;
            }

            foreach (DataRow drItem in dtItem.Rows)
            {
                WholeUpdateStockRequest request = new WholeUpdateStockRequest();

                request.goodsId = NumUtil.ToLong(drItem["F_GoodsID"]);
                List <WholeUpdateStockSku> skuList = new List <WholeUpdateStockSku>();

                skuList.Add(new WholeUpdateStockSku
                {
                    skuId        = NumUtil.ToLong(drItem["F_SkuID"]),
                    editStockNum = NumUtil.ToInt(drItem["F_Qty"])
                });
                request.storeId       = NumUtil.ToLong(drItem["F_ShopID"]);
                request.warehouseId   = NumUtil.ToLong(drItem["F_StorageID"]);
                request.warehouseCode = StrUtil.ConvToStr(drItem["F_StorageID"]);

                request.skuList = skuList;
                AddGoodsResponse response = HttpPostToWm <AddGoodsResponse>("ec/goods/wholeUpdateStock", request, preMsg);
            }
        }
コード例 #5
0
ファイル: OrderLogic.cs プロジェクト: 13802057046/testGitHub
        /// <summary>
        /// 发网>订单创建接口
        /// </summary>
        public void AddTradesToFw(DateTime startDate, DateTime endDate)
        {
            string preMsg = "发网 订单创建接口 ";

            string sql = @"select 
	                         a.F_ShopID
	                        ,a.F_BillId
	                        ,c.F_ExpressCode
	                        ,convert(varchar(100), a.F_Date, 20) as F_Date
	                        ,c.F_DeliveryPlanTime
	                        ,a.F_BillMoney
	                        ,c.F_Freight
	                        ,c.F_TotalAmount
	                        ,c.F_Payment
	                        ,c.F_InsuranceValue
	                        ,c.F_CommunitySyncCode
	                        ,c.F_BuyerNick
	                        ,a.F_Remark as F_Remark_Pos
	                        ,c.F_SourcePlatformCode
	                        ,c.F_Remark as F_Remark_OrderLogisticsInformation
	                        ,c.F_isPrintInvoice
	                        ,c.F_country
	                        ,c.F_dropoffType
	                        ,c.F_serviceType
	                        ,c.F_packagingType
	                        ,c.F_name
	                        ,c.F_zipCode
	                        ,c.F_phone
	                        ,c.F_mobilePhone
	                        ,c.F_province
	                        ,c.F_city
	                        ,c.F_county
	                        ,c.F_address
	                        ,c.F_address2
	                        ,c.F_senderName
	                        ,c.F_senderPhone
	                        ,c.F_senderMobile
                        from t_Pos a
                        left join T_OrderLogisticsInformation c on a.F_BillID = c.F_BillID
                        where a.F_Status='正常'
                          and a.F_BuildDate >= '" + startDate.ToString("yyyy-MM-dd HH:mm:ss") + @"'
                          and a.F_BuildDate < '" + endDate.ToString("yyyy-MM-dd HH:mm:ss") + "'";

            DataTable dtPos = sd.GetDataTable(sql);

            Log.WriteLog(preMsg + "取得的记录数:" + dtPos.Rows.Count + "行。", 1);
            if (dtPos.Rows.Count == 0)
            {
                return;
            }

            foreach (DataRow drPos in dtPos.Rows)
            {
                WmsTradesAddRequest          request  = new WmsTradesAddRequest();
                WmsTradesAddResponse         response = new WmsTradesAddResponse();
                WmsTradesAddRequest.Receiver receiver = new WmsTradesAddRequest.Receiver();
                receiver.Name        = drPos["F_name"].ToString();
                receiver.ZipCode     = drPos["F_zipCode"].ToString();
                receiver.Phone       = drPos["F_phone"].ToString();
                receiver.MobilePhone = drPos["F_mobilePhone"].ToString();
                receiver.Province    = drPos["F_province"].ToString();
                receiver.City        = drPos["F_city"].ToString();
                receiver.County      = drPos["F_county"].ToString();
                receiver.Address     = drPos["F_address"].ToString();
                //receiver.address2			= drPos["F_address2"].ToString(); todo

                //sender					List
                //senderName				String	32	是	发货人姓名	T_OrderLogisticsInformation.F_senderName
                //    senderPhone				String	32	否	发货人移动电话	T_OrderLogisticsInformation.F_senderPhone
                //    senderMobile				String	32	否	发货人固定电话	T_OrderLogisticsInformation.F_senderMobile

                List <WmsTradesAddRequest.Item> products = new List <WmsTradesAddRequest.Item>();
                sql = @"select 
                             v.F_BarCode
                            ,v.F_Name
                            ,a.F_NewPrice
                            ,a.F_Qty 
                        from t_PosDetail a 
                        left join V_Item_Pos v on a.F_ItemID = v.F_ID and a.F_ColorID = v.F_ColorID and a.F_SizeID = v.F_SizeID 
                        where F_Billid = '" + drPos["F_Billid"] + "'";
                DataTable dtDetail = sd.GetDataTable(sql);
                foreach (DataRow drDetail in dtDetail.Rows)
                {
                    products.Add(new WmsTradesAddRequest.Item()
                    {
                        BarCode  = drDetail["F_BarCode"].ToString(),
                        ItemName = drDetail["F_Name"].ToString(),
                        Price    = NumUtil.ToDouble(drDetail["F_NewPrice"]),
                        Quantity = NumUtil.ToInt(drDetail["F_Qty"]),
                    });
                }

                //containerPack					List
                //Pack				List
                //containerBarcode			String		否	包材编码	t_POSDetail.F_BarCode
                //    skus			List
                //    sku		List
                //    barCode	String	64	否	商品条码	t_POSDetail.F_BarCode
                //    quantity	int		否	数量	t_POSDetail.F_Qty
                List <WmsTradesAddRequest.Order> orders = new List <WmsTradesAddRequest.Order>();
                orders.Add(new WmsTradesAddRequest.Order()
                {
                    WareHouseCode = drPos["F_ShopID"].ToString(),
                    SaleOrderCode = drPos["F_BillId"].ToString(),
                    //orderType = 0, todo
                    LogisticsCode = drPos["F_ExpressCode"].ToString(),
                    SaleDate      = drPos["F_Date"].ToString(),
                    //deliveryPlanTime = drPos["F_DeliveryPlanTime"].ToString(), tod
                    ItemAmount  = NumUtil.ToDouble(drPos["F_BillMoney"]),
                    Freight     = NumUtil.ToDouble(drPos["F_Freight"]),
                    TotalAmount = NumUtil.ToDouble(drPos["F_TotalAmount"]),
                    Payment     = NumUtil.ToDouble(drPos["F_Payment"]),
                    //insuranceValue = NumUtil.ToDouble(drPos[".F_InsuranceValue"]), todo
                    //communitySyncCode = drPos["F_CommunitySyncCode"].ToString(),
                    BuyerNick          = drPos["F_BuyerNick"].ToString(),
                    TradeId            = drPos["F_Remark_Pos"].ToString(),
                    SourcePlatformCode = drPos["F_SourcePlatformCode"].ToString(),
                    Remark             = drPos["F_Remark_OrderLogisticsInformation"].ToString(),
                    //isPrintInvoice = NumUtil.ToBoolean(drPos["F_isPrintInvoice"]), todo
                    //country = drPos["F_country"].ToString(), todo
                    //dropoffType = drPos["F_dropoffType"].ToString(), todo
                    //serviceType = drPos["F_serviceType"].ToString(), todo
                    //packagingType = drPos["F_packagingType"].ToString(), todo
                    Receiver = receiver,
                    Items    = products
                });
                request.Orders = orders;

                response = HttpPostToFw <WmsTradesAddResponse>(request, preMsg);
            }

            Log.WriteLog(preMsg + "完成。" + startDate.ToString("yyyy-MM-dd HH:mm:ss") + " ~ " + endDate.ToString("yyyy-MM-dd HH:mm:ss"), 1);
        }
コード例 #6
0
        /// <summary>
        /// 微盟-商品信息-添加商品(ec/goods/addGoods)
        /// </summary>
        public void AddGoodsToWm(DateTime startDate, DateTime endDate)
        {
            string preMsg = "微盟 添加商品 ";

            string sql = @"select a.F_GoodsID, a.F_SkuID, a.F_CategoryID, a.F_Name, a.F_ID, a.F_Stop, z.F_PosPrice, a.F_CostPrice, b.F_Qty
                            from v_Item_NoPic a 
                            left join (select F_ItemZID,F_PosPrice from t_ItemZonePriceOne where F_ZoneID = '01') z on a.F_ID = z.F_ItemZID 
                            left join t_StorageQty b on a.F_ID = b.F_ItemID and a.F_ColorID = b.F_ColorID and a.F_SizeID = b.F_SizeID 
                            where a.F_CreaterDate >= '" + startDate.ToString("yyyy-MM-dd HH:mm:ss") + @"'
                              and a.F_CreaterDate < '" + endDate.ToString("yyyy-MM-dd HH:mm:ss") + @"'
                              and a.F_GoodsID is null ";

            DataTable dtItem = sd.GetDataTable(sql);

            Log.WriteLog(preMsg + "取得的记录数:" + dtItem.Rows.Count + "行。", 1);
            if (dtItem.Rows.Count == 0)
            {
                return;
            }

            foreach (DataRow drItem in dtItem.Rows)
            {
                AddGoodsRequest   request = new AddGoodsRequest();
                PendingAddGoodsVo goods   = new PendingAddGoodsVo();
                goods.title         = drItem["F_Name"].ToString();
                goods.isMultiSku    = 0;
                goods.goodsImageUrl = new List <string> {
                    G_INI.ReadValue("Local", "goodsImageUrl")
                };
                goods.initialSales    = 0;
                goods.deductStockType = 1;
                goods.isPutAway       = NumUtil.ToInt(drItem["F_Stop"]);
                goods.Sort            = 0;
                goods.categoryId      = NumUtil.ToLong(drItem["F_CategoryID"]);
                goods.b2cGoods        = new PendingB2CGoodsVo
                {
                    freightTemplateId  = NumUtil.ToLong(G_INI.ReadValue("Local", "freightTemplateId")),
                    deliveryTypeIdList = new List <long> {
                        NumUtil.ToLong(G_INI.ReadValue("Local", "deliveryTypeId"))
                    },
                    b2cGoodsType = 0
                };
                goods.skuList = new List <PendingSkuVo>
                {
                    new PendingSkuVo {
                        outerSkuCode = drItem["F_ID"].ToString(),
                        salePrice    = NumUtil.ToDecimal(drItem["F_PosPrice"]),
                        costPrice    = NumUtil.ToDecimal(drItem["F_CostPrice"]),
                        editStockNum = NumUtil.ToInt(drItem["F_Qty"]),
                        b2cSku       = new PendingB2CSkuVo
                        {
                            weight = 0,
                            volume = 0
                        }
                    }
                };
                request.goods = goods;
                AddGoodsResponse response = HttpPostToWm <AddGoodsResponse>("ec/goods/addGoods", request, preMsg);
                sql = "update t_Item set F_GoodsID = " + response.data.goodsId +
                      " where F_ID = '" + StrUtil.ConvToStr(drItem["F_ID"]) + "';";
                if (response.data.skuList.Count > 0)
                {
                    sql += "update t_ItemDetail set F_SkuID = " + response.data.skuList[0].skuId +
                           " where F_ItemID = '" + StrUtil.ConvToStr(drItem["F_ID"]) + "';";
                }

                int cnt = sd.ExcuteNonQuery(sql);
            }
        }
コード例 #7
0
        /// <summary>
        /// 微盟-商品信息-更新商品(ec/goods/updateGoods)
        /// </summary>
        public void UpdateGoodsToWm(DateTime startDate, DateTime endDate)
        {
            string preMsg = "微盟 更新商品 ";

            string sql = @"select a.F_GoodsID, a.F_SkuID, a.F_CategoryID, a.F_Name, a.F_ID, a.F_Stop, z.F_PosPrice, a.F_CostPrice, b.F_Qty
                            from v_Item_NoPic a 
                            left join (select F_ItemZID,F_PosPrice from t_ItemZonePriceOne where F_ZoneID = '01') z on a.F_ID = z.F_ItemZID 
                            left join t_StorageQty b on a.F_ID = b.F_ItemID and a.F_ColorID = b.F_ColorID and a.F_SizeID = b.F_SizeID 
                            where a.F_UpdateTime >= '" + startDate.ToString("yyyy-MM-dd HH:mm:ss") + @"'
                              and a.F_UpdateTime < '" + endDate.ToString("yyyy-MM-dd HH:mm:ss") + @"'
                              and a.F_GoodsID is not null ";

            DataTable dtItem = sd.GetDataTable(sql);

            Log.WriteLog(preMsg + "取得的记录数:" + dtItem.Rows.Count + "行。", 1);
            if (dtItem.Rows.Count == 0)
            {
                return;
            }

            foreach (DataRow drItem in dtItem.Rows)
            {
                QueryGoodsDetailRequest queryReq = new QueryGoodsDetailRequest();
                queryReq.goodsId = NumUtil.ToLong(drItem["F_GoodsID"]);
                QueryGoodsDetailResponse queryRsp = HttpPostToWm <QueryGoodsDetailResponse>("ec/goods/queryGoodsDetail", queryReq, preMsg);

                UpdateGoodsRequest   request = new UpdateGoodsRequest();
                PendingUpdateGoodsVo goods   = new PendingUpdateGoodsVo();
                goods.goodsId       = NumUtil.GetVal_Long(drItem["F_GoodsID"]);
                goods.title         = drItem["F_Name"].ToString();
                goods.isMultiSku    = 0;
                goods.goodsImageUrl = queryRsp.data.goods.goodsImageUrl;
                //goods.goodsDesc = "";
                goods.initialSales    = 0;
                goods.deductStockType = 1;
                goods.isPutAway       = NumUtil.ToInt(drItem["F_Stop"]);
                goods.Sort            = 0;
                goods.categoryId      = NumUtil.ToLong(drItem["F_CategoryID"]);
                goods.b2cGoods        = new PendingB2CGoodsVo
                {
                    freightTemplateId  = NumUtil.ToLong(G_INI.ReadValue("Local", "freightTemplateId")),
                    deliveryTypeIdList = new List <long> {
                        NumUtil.ToLong(G_INI.ReadValue("Local", "deliveryTypeId"))
                    },
                    b2cGoodsType = 0
                };
                goods.skuList = new List <PendingSkuVo>
                {
                    new PendingSkuVo {
                        skuId        = NumUtil.ToLong(drItem["F_SkuID"]),
                        outerSkuCode = drItem["F_ID"].ToString(),
                        salePrice    = NumUtil.ToDecimal(drItem["F_CostPrice"]),
                        costPrice    = NumUtil.ToInt(drItem["F_Qty"]),
                        editStockNum = 0,
                        b2cSku       = new PendingB2CSkuVo
                        {
                            weight = 0,
                            volume = 0
                        }
                    }
                };
                request.goods = goods;
                UpdateGoodsResponse response = HttpPostToWm <UpdateGoodsResponse>("ec/goods/updateGoods", request, preMsg);
            }
        }