public Response <string> AddExpressAndUpdatePackageYD(YdResponseParam responseParam, Entity.PackageInfo package, PdfInfoObj obj) { Response <string> response = new Response <string>(); try { ExpressAccessor accessor = new ExpressAccessor(); response.Result = accessor.AddExpressAndUpdatePackageYD(responseParam, package, obj); if (response.Result == "") { response.IsSuccess = true; } else { response.IsSuccess = false; } } catch (Exception ex) { LogError(ex); response.Exception = ex; response.IsSuccess = false; response.Result = ex.Message; } return(response); }
public string AddExpressAndUpdatePackageYD(YdResponseParam responseParam, Entity.PackageInfo package, PdfInfoObj obj) { try { string sql = string.Format(@"INSERT INTO dbo.WMS_ExpressDelivery (CustomerID,CustomerName,WarehouseID,WarehouseName,OID,OrderNumber,ExternOrderNumber, ExpressNumber,ExpressCompany,PackageNumber, Status,success,code,orderSerialNo,mailNo,pdfInfo,msg, position,position_no,four_code,package_wdjc,cus_area1, Creator,CreateTime) SELECT CustomerID,CustomerName, (SELECT TOP 1 w.ID FROM dbo.WMS_Warehouse w WHERE w.WarehouseName =p.Warehouse) WarehouseID,Warehouse,OID,OrderNumber,ExternOrderNumber, {2},'韵达',PackageNumber, 0,'true','200','{1}','{2}','{3}','{4}', '{5}','{6}','{7}','{8}','{9}', '韵达',GETDATE() FROM dbo.WMS_Package p WHERE p.PackageNumber='{0}'; --更新包装快递信息 UPDATE dbo.WMS_Package SET ExpressCompany='韵达',ExpressNumber='{2}' WHERE PackageNumber='{0}'; --更新订单主表快递 UPDATE o SET o.ExpressCompany=p.ExpressCompany,o.ExpressNumber=p.ExpressNumber FROM dbo.WMS_Order o, (SELECT TOP 1 * FROM dbo.WMS_Package WHERE OrderNumber =(SELECT TOP 1 OrderNumber FROM dbo.WMS_Package WHERE PackageNumber='{0}')) p WHERE o.ID=p.OID; SELECT TOP 1000 * FROM dbo.WMS_ExpressDelivery WHERE ID=@@IDENTITY;", package.PackageNumber, responseParam.order_serial_no, responseParam.mail_no, responseParam.pdf_info, responseParam.msg, obj.position, obj.position_no, obj.four_code, obj.package_wdjc, obj.cus_area1); base.ExecuteNoQueryBySqlString(sql); return(""); } catch (Exception ex) { return("新增失败"); } }