/// <summary> /// 退货/退款商家确认收货接口(ec/rights/confirmReceivedRightsGoods) /// </summary> public void ConfirmReceivedRightsGoodsToWm(DateTime startDate, DateTime endDate) { string preMsg = "微盟 订单发货(单个) "; string sql = @"select a.F_BillID, F_ExpressNum, F_ExpressCode 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) { ConfirmReceivedRightsGoodsRequest request = new ConfirmReceivedRightsGoodsRequest(); request.id = NumUtil.ToLong(drDetail["F_BillID"]); ConfirmReceivedRightsGoodsResponse response = HttpPostToWm <ConfirmReceivedRightsGoodsResponse>("ec/rights/confirmReceivedRightsGoods", request, preMsg); } }
/// <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); } }
/// <summary> /// 微盟-订单发货(单个)(ec/order/deliveryOrder) /// </summary> public void DeliveryOrderToWm(DateTime startDate, DateTime endDate) { string preMsg = "微盟 订单发货(单个) "; string sql = @"select a.F_BillID, F_ExpressNum, F_ExpressCode 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) { DeliveryOrderRequest request = new DeliveryOrderRequest(); request.orderNo = NumUtil.ToLong(drDetail["F_BillID"]); request.deliveryNo = drDetail["F_ExpressNum"].ToString(); request.deliveryCompanyCode = drDetail["F_ExpressCode"].ToString(); DeliveryOrderResponse response = HttpPostToWm <DeliveryOrderResponse>("ec/order/deliveryOrder", request, preMsg); } }
/// <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); } }
/// <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); } }