Beispiel #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);
        }
Beispiel #2
0
        /// <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);
        }