Example #1
0
        /// <summary>
        /// 发网>创建出入库单接口;采购入库、调拨出库
        /// </summary>
        public void AddOutInToFw(DateTime startDate, DateTime endDate)
        {
            string preMsg = "发网 创建出入库单 ";

            string sql = @"select a.F_ShopID, a.F_Billid, a.F_Remark
                            from t_StockOrder a 
                            where a.F_CreateTime >= '" + startDate.ToString("yyyy-MM-dd HH:mm:ss") + @"'
                              and a.F_CreateTime < '" + endDate.ToString("yyyy-MM-dd HH:mm:ss") + "'";

            DataTable dtStockOrder = sd.GetDataTable(sql);

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

            foreach (DataRow drStockOrder in dtStockOrder.Rows)
            {
                FwPurchaseOutinorderAddRequest   request  = new FwPurchaseOutinorderAddRequest();
                WmsPurchaseOutinorderAddResponse response = new WmsPurchaseOutinorderAddResponse();
                request.ActionType    = "IN";
                request.WareHouseCode = drStockOrder["F_ShopID"].ToString();
                request.SyncId        = drStockOrder["F_Billid"].ToString();
                request.Remark        = drStockOrder["F_Remark"].ToString();
                List <FwPurchaseOutinorderAddRequest.Item> products = new List <FwPurchaseOutinorderAddRequest.Item>();

                DataTable dtDetail = sd.GetDataTable("select b.F_BarCode, a.F_Order, a.F_Qty, a.F_Price  from t_StockOrderDetail a " +
                                                     "  left join v_Item_NoPic b on a.F_ItemID = b.F_ID and a.F_ColorID = b.F_ColorID and a.F_SizeID = b.F_SizeID" +
                                                     " where F_Billid = '" + drStockOrder["F_Billid"] + "'");
                foreach (DataRow drDetail in dtDetail.Rows)
                {
                    products.Add(new FwPurchaseOutinorderAddRequest.Item()
                    {
                        BarCode       = drDetail["F_BarCode"].ToString(),
                        InventoryType = "NORMAL",
                        Quantity      = (int)NumUtil.ToDouble(drDetail["F_Qty"]),
                        LineNo        = StrUtil.ConvToStr(drDetail["F_Order"]),
                        UnitPrice     = NumUtil.ToDouble(drDetail["F_Price"]),
                        TotalPrice    = NumUtil.ToDouble(drDetail["F_Price"]) * NumUtil.ToDouble(drDetail["F_Qty"])
                    });
                }

                request.Items = products;
                response      = HttpPostToFw <WmsPurchaseOutinorderAddResponse>(request, preMsg);
            }

            Log.WriteLog(preMsg + "完成。" + startDate.ToString("yyyy-MM-dd HH:mm:ss") + " ~ " + endDate.ToString("yyyy-MM-dd HH:mm:ss"), 1);
        }
Example #2
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);
        }
Example #3
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);
            }
        }
Example #4
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);
            }
        }